]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: Wait until preattach to service FSSYNC reqs
authorAndrew Deason <adeason@sinenomine.net>
Wed, 30 Sep 2009 21:50:07 +0000 (16:50 -0500)
committerDerrick Brashear <shadow|account-1000005@unknown>
Thu, 1 Oct 2009 08:49:53 +0000 (01:49 -0700)
Make FSYNC_sync wait until VInit == 2 before serving FSSYNC requests.
This follows the existing similar behavior of waiting until after volume
preattachment is completed before serving RPC requests in DAFS. This
prevents FSSYNC clients from being denied requests simply due to a
volume not having been preattached yet, at the small cost of delaying
how soon we can serve FSSYNC requests.

This does not alter the behavior of non-DAFS, which still only waits
until VInit == 1, since volume attachment takes significantly longer
than preattachment.

Reviewed-on: http://gerrit.openafs.org/563
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/vol/fssync-server.c

index 83251aef0b405e5d58934345c826d3f87eaaafbe..65e35371795dfb605fbbe200f806d63d05fc4003 100644 (file)
@@ -223,7 +223,15 @@ FSYNC_sync(void * args)
     SYNC_server_state_t * state = &fssync_server_state;
 #ifdef AFS_DEMAND_ATTACH_FS
     VThreadOptions_t * thread_opts;
-#endif
+    int min_vinit = 2;
+#else
+    /*
+     * For non-DAFS, only wait until we begin attaching volumes (instead
+     * of waiting until all volumes are attached), since it can take
+     * awhile until VInit == 2.
+     */
+    int min_vinit = 1;
+#endif /* AFS_DEMAND_ATTACH_FS */
 
     SYNC_getAddr(&state->endpoint, &state->addr);
     SYNC_cleanupSock(state);
@@ -241,9 +249,11 @@ FSYNC_sync(void * args)
     Log("Set thread id %d for FSYNC_sync\n", tid);
 #endif /* AFS_PTHREAD_ENV */
 
-    while (!VInit) {
-       /* Let somebody else run until level > 0.  That doesn't mean that 
-        * all volumes have been attached. */
+    while (VInit < min_vinit) {
+       /* Let somebody else run until all volumes have been preattached
+        * (DAFS), or we have started attaching volumes (non-DAFS). This
+        * doesn't mean that all volumes have been attached.
+        */
 #ifdef AFS_PTHREAD_ENV
        pthread_yield();
 #else /* AFS_PTHREAD_ENV */