From 031f5eb528c94c1ad13fb1485db5cd40bc2877c2 Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 30 Sep 2009 16:50:07 -0500 Subject: [PATCH] DAFS: Wait until preattach to service FSSYNC reqs 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 Reviewed-by: Derrick Brashear --- src/vol/fssync-server.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/vol/fssync-server.c b/src/vol/fssync-server.c index 83251aef0..65e353717 100644 --- a/src/vol/fssync-server.c +++ b/src/vol/fssync-server.c @@ -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 */ -- 2.39.5