From 1649a820a068ce7d74479a9bea98edfe6f0d2bfd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 2 Sep 2011 18:32:40 -0400 Subject: [PATCH] Windows: improve handling of volume rename 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. Reviewed-on: http://gerrit.openafs.org/5330 Tested-by: BuildBot Tested-by: Jeffrey Altman Reviewed-by: Jeffrey Altman (cherry picked from commit f37b6dfaf050ec0270979c8310fb471c16b66cd3) Change-Id: I33771780a4ace4aa5b4613bef4590d5efaf15922 Reviewed-on: http://gerrit.openafs.org/6021 Tested-by: BuildBot Reviewed-by: Jeffrey Altman Tested-by: Jeffrey Altman --- src/WINNT/afsd/cm_volume.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/WINNT/afsd/cm_volume.c b/src/WINNT/afsd/cm_volume.c index 24d177e41..5e603d884 100644 --- a/src/WINNT/afsd/cm_volume.c +++ b/src/WINNT/afsd/cm_volume.c @@ -340,6 +340,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; -- 2.39.5