Windows: improve handling of volume rename
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 2 Sep 2011 22:32:40 +0000 (18:32 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Sat, 3 Sep 2011 04:43:13 +0000 (21:43 -0700)
The windows cache manager tracks volumes by volume group.
Up to this point all volume location updates have been performed
by the volume name.  What if the volume name was altered?  In this
case the volume location information for the in use volume ids will
fail until a mount point to the new name is queried.  Before
marking the volume group as non-existent attempt to perform a
lookup using either the volume id for the readwrite or readonly
volume.

Change-Id: I51b383150b0186867e1c51a28b01e8483ee470f2
Reviewed-on: http://gerrit.openafs.org/5330
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_volume.c

index 5a4c592..bfec95c 100644 (file)
@@ -353,6 +353,27 @@ long cm_UpdateVolumeLocation(struct cm_cell *cellp, cm_user_t *userp, cm_req_t *
                                  &method, userp, reqp);
     }
 
+    /*
+     * What if there was a volume rename?  The volume name no longer exists but the
+     * volume id might.  Try to refresh the volume location information based one
+     * of the readwrite or readonly volume id.
+     */
+    if (code == CM_ERROR_NOSUCHVOLUME) {
+        if (volp->vol[RWVOL].ID != 0) {
+            code = cm_GetEntryByID(cellp, volp->vol[RWVOL].ID, &vldbEntry, &nvldbEntry,
+#ifdef MULTIHOMED
+                                    &uvldbEntry,
+#endif
+                                    &method, userp, reqp);
+        } else if (volp->vol[ROVOL].ID != 0) {
+            code = cm_GetEntryByID(cellp, volp->vol[ROVOL].ID, &vldbEntry, &nvldbEntry,
+#ifdef MULTIHOMED
+                                    &uvldbEntry,
+#endif
+                                    &method, userp, reqp);
+        }
+    }
+
     lock_ObtainWrite(&volp->rw);
     if (code == 0) {
         afs_int32 flags;