ubik: set UBIK_RECLABELDB before propagating version
authorMarc Dionne <marc.c.dionne@gmail.com>
Sat, 16 Apr 2011 16:56:05 +0000 (12:56 -0400)
committerDerrick Brashear <shadow@dementia.org>
Wed, 27 Apr 2011 00:30:38 +0000 (17:30 -0700)
Quoting Jeffrey Hutzelman:

In udisk_commit(), when committing the first write transaction
after becoming sync site, the database is relabelled.  In this
case, the UBIK_RECLABELDB recovery state bit should be set before
propagating the label change to other servers, rather than after.

This is because ContactQuorum_DISK_Setversion() will
release the database lock, at which point the recovery state may
be cleared by urecovery_ResetState() running in another thread.
It is important that a relabelling which occurs before recovery
state is cleared not result in the UBIK_RECLABELDB recovery state
bit being set after; otherwise, the server may fail to correctly
relabel the database the next time it becomes sync site.

Change-Id: I9753a24c84cf45cdbb11a1d8b7ab262fbe487204
Reviewed-on: http://gerrit.openafs.org/4489
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

src/ubik/disk.c

index 1048edd..17685ec 100644 (file)
@@ -886,13 +886,14 @@ udisk_commit(struct ubik_trans *atrans)
            dbase->version = newversion;
            UBIK_VERSION_UNLOCK;
 
+           urecovery_state |= UBIK_RECLABELDB;
+
            /* Ignore the error here. If the call fails, the site is
             * marked down and when we detect it is up again, we will
             * send the entire database to it.
             */
            ContactQuorum_DISK_SetVersion( atrans, 1 /*CStampVersion */ ,
                                           &oldversion, &newversion);
-           urecovery_state |= UBIK_RECLABELDB;
        }
 
        UBIK_VERSION_LOCK;