summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/primary.c
diff options
context:
space:
mode:
authortrociny <trociny@FreeBSD.org>2011-03-22 20:27:26 +0000
committertrociny <trociny@FreeBSD.org>2011-03-22 20:27:26 +0000
commit9a2a9da63191f9dd3cbcd0745e68e0c2887adbe3 (patch)
tree8376a860e9b6021ee72ce005783c54e926cdeebc /sbin/hastd/primary.c
parent359437c29d11907a23adb3fad38aeb079f576f7e (diff)
downloadFreeBSD-src-9a2a9da63191f9dd3cbcd0745e68e0c2887adbe3.zip
FreeBSD-src-9a2a9da63191f9dd3cbcd0745e68e0c2887adbe3.tar.gz
After synchronization is complete we should make primary counters be
equal to secondary counters: primary_localcnt = secondary_remotecnt primary_remotecnt = secondary_localcnt Previously it was done wrong and split-brain was observed after primary had synchronized up-to-date data from secondary. Approved by: pjd (mentor) MFC after: 1 week
Diffstat (limited to 'sbin/hastd/primary.c')
-rw-r--r--sbin/hastd/primary.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index b943077..966973b 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -1757,13 +1757,13 @@ sync_thread(void *arg __unused)
mtx_lock(&metadata_lock);
res->hr_syncsrc = HAST_SYNCSRC_UNDEF;
res->hr_primary_localcnt =
- res->hr_secondary_localcnt;
- res->hr_primary_remotecnt =
res->hr_secondary_remotecnt;
+ res->hr_primary_remotecnt =
+ res->hr_secondary_localcnt;
pjdlog_debug(1,
"Setting localcnt to %ju and remotecnt to %ju.",
(uintmax_t)res->hr_primary_localcnt,
- (uintmax_t)res->hr_secondary_localcnt);
+ (uintmax_t)res->hr_primary_remotecnt);
(void)metadata_write(res);
mtx_unlock(&metadata_lock);
}
OpenPOWER on IntegriCloud