Author: pjd
Date: Mon Mar 21 21:16:12 2011
New Revision: 219844
URL: http://svn.freebsd.org/changeset/base/219844

Log:
  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

Modified:
  head/sbin/hastd/primary.c

Modified: head/sbin/hastd/primary.c
==============================================================================
--- head/sbin/hastd/primary.c   Mon Mar 21 21:14:07 2011        (r219843)
+++ head/sbin/hastd/primary.c   Mon Mar 21 21:16:12 2011        (r219844)
@@ -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 (;;) {
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to