summaryrefslogtreecommitdiffstats
path: root/sbin/hastd/primary.c
diff options
context:
space:
mode:
authorpjd <pjd@FreeBSD.org>2011-03-21 21:16:12 +0000
committerpjd <pjd@FreeBSD.org>2011-03-21 21:16:12 +0000
commita444cd56818258c1c8aefcbb26d5c76539e66567 (patch)
tree2644e9821df4d276cbbabc99799950de681736cc /sbin/hastd/primary.c
parenta53d08470e8b5820e7564ec739a5b18739e824b8 (diff)
downloadFreeBSD-src-a444cd56818258c1c8aefcbb26d5c76539e66567.zip
FreeBSD-src-a444cd56818258c1c8aefcbb26d5c76539e66567.tar.gz
Initialize localcnt on first write. This fixes assertion when we create
resource, set role to primary, do no writes, then sent it to secondary and accept connection from primary. MFC after: 1 week
Diffstat (limited to 'sbin/hastd/primary.c')
-rw-r--r--sbin/hastd/primary.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sbin/hastd/primary.c b/sbin/hastd/primary.c
index 8beba48..6b219f8 100644
--- a/sbin/hastd/primary.c
+++ b/sbin/hastd/primary.c
@@ -478,7 +478,7 @@ init_local(struct hast_resource *res)
* that there were no writes yet, so there is no need to synchronize
* anything.
*/
- res->hr_primary_localcnt = 1;
+ res->hr_primary_localcnt = 0;
res->hr_primary_remotecnt = 0;
if (metadata_write(res) < 0)
exit(EX_NOINPUT);
@@ -1093,7 +1093,11 @@ ggate_recv_thread(void *arg)
break;
case BIO_WRITE:
if (res->hr_resuid == 0) {
- /* This is first write, initialize resuid. */
+ /*
+ * This is first write, initialize localcnt and
+ * resuid.
+ */
+ res->hr_primary_localcnt = 1;
(void)init_resuid(res);
}
for (;;) {
OpenPOWER on IntegriCloud