salvager: Do not break cbks when salvaging parts
authorAndrew Deason <adeason@sinenomine.net>
Wed, 29 Sep 2010 16:48:44 +0000 (11:48 -0500)
committerDerrick Brashear <shadow@dementia.org>
Thu, 11 Nov 2010 16:20:54 +0000 (08:20 -0800)
When salvaging whole partitions / whole servers, the fileserver is
assumed to not be running. So only break callbacks if we are salvaging
a single volume. If we are salvaging a whole partition, do not tell
the fileserver to break callbacks on changed volumes, since the
fileserver will not be around and we will just hang.

Change-Id: Ia158d5a00574a6907b9b040510ef7d827a2ee05d
Reviewed-on: http://gerrit.openafs.org/2865
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>

src/vol/vol-salvage.c

index 84efe4e..1fc0a12 100644 (file)
@@ -306,6 +306,8 @@ struct SalvInfo {
                                                 *   vnodes in the volume that
                                                 *   we are currently looking
                                                 *   at */
+    int useFSYNC; /**< 0 if the fileserver is unavailable; 1 if we should try
+                   *   to contact the fileserver over FSYNC */
 };
 
 char *tmpdir = NULL;
@@ -790,6 +792,7 @@ SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber)
            Abort("Couldn't connect to file server\n");
        }
 
+       salvinfo->useFSYNC = 1;
        AskOffline(salvinfo, singleVolumeNumber);
 #ifdef AFS_DEMAND_ATTACH_FS
        if (LockVolume(salvinfo, singleVolumeNumber)) {
@@ -798,6 +801,7 @@ SalvageFileSys1(struct DiskPartition64 *partP, VolumeId singleVolumeNumber)
 #endif /* AFS_DEMAND_ATTACH_FS */
 
     } else {
+       salvinfo->useFSYNC = 0;
        VLockPartition(partP->name);
        if (ForceSalvage) {
            ForceSalvage = 1;
@@ -4084,7 +4088,7 @@ SalvageVolume(struct SalvInfo *salvinfo, struct InodeSummary *rwIsp, IHandle_t *
     }
 
 #ifdef FSSYNC_BUILD_CLIENT
-    if (!Testing && salvinfo->VolumeChanged) {
+    if (!Testing && salvinfo->VolumeChanged && salvinfo->useFSYNC) {
        afs_int32 fsync_code;
 
        fsync_code = FSYNC_VolOp(vid, NULL, FSYNC_VOL_BREAKCBKS, FSYNC_SALVAGE, NULL);