ubik: SDISK_Begin no quorum, wrong db, no transaction
authorJeffrey Altman <jaltman@your-file-system.com>
Thu, 22 Jan 2015 06:14:28 +0000 (01:14 -0500)
committerJeffrey Altman <jaltman@your-file-system.com>
Wed, 25 Feb 2015 16:35:21 +0000 (11:35 -0500)
When processing an DISK_Begin RPC verify that there is an active quorum
and that the local database is current.  Otherwise, fail the RPC with
a UNOQUORUM error.

The returned error must be UNOQUORUM instead of USYNC becase the returned
error code will be returned by the coordinator's ContactQuorum_iterate()
to the client that triggered the write transaction.  Most ubik clients
will only retry if the error is UNOQUORUM.

FIXES 131997

Change-Id: Icaa30e6aca82e7e7d33e9171a4f023970aba61df
Reviewed-on: http://gerrit.openafs.org/11689
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Daria Brashear <shadow@your-file-system.com>
Reviewed-by: Benjamin Kaduk <kaduk@mit.edu>
Reviewed-by: Jeffrey Hutzelman <jhutz@cmu.edu>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>

src/ubik/remote.c

index 37d9384..d9e1b1c 100644 (file)
@@ -55,6 +55,10 @@ SDISK_Begin(struct rx_call *rxcall, struct ubik_tid *atid)
        return code;
     }
     DBHOLD(ubik_dbase);
+    if (urecovery_AllBetter(ubik_dbase, 0) == 0) {
+       code = UNOQUORUM;
+       goto out;
+    }
     urecovery_CheckTid(atid, 1);
     code = udisk_begin(ubik_dbase, UBIK_WRITETRANS, &ubik_currentTrans);
     if (!code && ubik_currentTrans) {
@@ -62,6 +66,7 @@ SDISK_Begin(struct rx_call *rxcall, struct ubik_tid *atid)
        ubik_currentTrans->tid.epoch = atid->epoch;
        ubik_currentTrans->tid.counter = atid->counter;
     }
+  out:
     DBRELE(ubik_dbase);
     return code;
 }