aboutsummaryrefslogtreecommitdiff
path: root/sbin/hastd/hastd.c
diff options
context:
space:
mode:
authorPawel Jakub Dawidek <pjd@FreeBSD.org>2011-04-20 18:43:28 +0000
committerPawel Jakub Dawidek <pjd@FreeBSD.org>2011-04-20 18:43:28 +0000
commitac0401e321f4c4d6952b60a8e5889e46385b96fa (patch)
tree518b413604555317bc5b158f47838e0526930e07 /sbin/hastd/hastd.c
parentb5a6d97e1e620d8fc5e6cceadbb1971e23ab527e (diff)
downloadsrc-ac0401e321f4c4d6952b60a8e5889e46385b96fa.tar.gz
src-ac0401e321f4c4d6952b60a8e5889e46385b96fa.zip
When we become primary, we connect to the remote and expect it to be in
secondary role. It is possible that the remote node is primary, but only because there was a role change and it didn't finish cleaning up (unmounting file systems, etc.). If we detect such situation, wait for the remote node to switch the role to secondary before accepting I/Os. If we don't wait for it in that case, we will most likely cause split-brain. MFC after: 1 week
Notes
Notes: svn path=/head/; revision=220898
Diffstat (limited to 'sbin/hastd/hastd.c')
-rw-r--r--sbin/hastd/hastd.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/sbin/hastd/hastd.c b/sbin/hastd/hastd.c
index 444dd633ff89..7f87dd6ad1d6 100644
--- a/sbin/hastd/hastd.c
+++ b/sbin/hastd/hastd.c
@@ -736,6 +736,13 @@ listen_accept(void)
nv_add_stringf(nverr, "errmsg",
"Remote node acts as %s for the resource and not as %s.",
role2str(res->hr_role), role2str(HAST_ROLE_SECONDARY));
+ if (res->hr_role == HAST_ROLE_PRIMARY) {
+ /*
+ * If we act as primary request the other side to wait
+ * for us for a bit, as may might be finishing cleanups.
+ */
+ nv_add_uint8(nverr, 1, "wait");
+ }
goto fail;
}
/* Does token (if exists) match? */