]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
DAFS: Avoid SALVSYNC communication during shutdown
authorAndrew Deason <adeason@sinenomine.net>
Mon, 2 Nov 2009 18:19:45 +0000 (12:19 -0600)
committerDerrick Brashear <shadow|account-1000005@unknown>
Tue, 3 Nov 2009 19:42:32 +0000 (11:42 -0800)
Avoid trying to contact the salvageserver for any reason while we are
shutting down. During shutdown the salvageserver may not be around
anymore, so any SALVSYNC communication will appear to hang.

Just set a global flag to indicate 'no-SALVSYNC' on shutdown, in
addition to the thread-local flag we already have.

Change-Id: Id96f20917fd0753b4934a0377b91032b2ea3d0dc
Reviewed-on: http://gerrit.openafs.org/765
Tested-by: Andrew Deason <adeason@sinenomine.net>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
src/viced/viced.c
src/vol/volume.c
src/vol/volume.h

index 3e52e2c33591d9be651d8b88853bb256711846b1..e1666575689e003fb0155d7fd4c8f3fffbfe8cbc 100644 (file)
@@ -782,6 +782,8 @@ ShutDownAndCore(int dopanic)
      * are returned with an error code of RX_RESTARTING ( transient failure ) */
     rx_SetRxTranquil();                /* dhruba */
 
+    VSetTranquil();
+
 #ifdef AFS_DEMAND_ATTACH_FS
     FS_STATE_WRLOCK;
     fs_state.mode = FS_MODE_SHUTDOWN;
index b271e5e061b2beac95893a650c7d3021d866a2fe..313cb4256fb9457593d8c42b22a4f92cb0c738e3 100644 (file)
@@ -157,6 +157,12 @@ int vol_attach_threads = 1;
 
 #ifdef AFS_DEMAND_ATTACH_FS
 pthread_mutex_t vol_salvsync_mutex;
+
+/*
+ * Set this to 1 to disallow SALVSYNC communication in all threads; used
+ * during shutdown, since the salvageserver may have gone away.
+ */
+static volatile sig_atomic_t vol_disallow_salvsync = 0;
 #endif /* AFS_DEMAND_ATTACH_FS */
 
 #ifdef AFS_OSF_ENV
@@ -901,6 +907,26 @@ VShutdown(void)
     VOL_UNLOCK;
 }
 
+/**
+ * stop new activity (e.g. SALVSYNC) from occurring
+ *
+ * Use this to make the volume package less busy; for example, during
+ * shutdown. This doesn't actually shutdown/detach anything in the
+ * volume package, but prevents certain processes from ocurring. For
+ * example, preventing new SALVSYNC communication in DAFS. In theory, we
+ * could also use this to prevent new volume attachment, or prevent
+ * other programs from checking out volumes, etc.
+ */
+void
+VSetTranquil(void)
+{
+#ifdef AFS_DEMAND_ATTACH_FS
+    /* make sure we don't try to contact the salvageserver, since it may
+     * not be around anymore */
+    vol_disallow_salvsync = 1;
+#endif
+}
+
 #ifdef AFS_DEMAND_ATTACH_FS
 /*
  * demand attach fs
@@ -4170,7 +4196,7 @@ VScheduleSalvage_r(Volume * vp)
     if (thread_opts == NULL) {
        thread_opts = &VThread_defaults;
     }
-    if (thread_opts->disallow_salvsync) {
+    if (thread_opts->disallow_salvsync || vol_disallow_salvsync) {
        return 1;
     }
 
index 96565bb5fe6fac2cec971f5a662190637582a550..d1d4d5416d26150423fabbbb9fe8a8b6ad1cac5b 100644 (file)
@@ -763,6 +763,7 @@ extern Volume *VAttachVolumeByName(Error * ec, char *partition, char *name,
 extern Volume *VAttachVolumeByName_r(Error * ec, char *partition, char *name,
                                     int mode);
 extern void VShutdown(void);
+extern void VSetTranquil(void);
 extern void VUpdateVolume(Error * ec, Volume * vp);
 extern void VUpdateVolume_r(Error * ec, Volume * vp, int flags);
 extern void VAddToVolumeUpdateList(Error * ec, Volume * vp);