Windows: Force rebuilding Freelance directory in AddMount and AddSymlink
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 2 May 2010 18:48:00 +0000 (14:48 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Sun, 2 May 2010 19:12:49 +0000 (12:12 -0700)
cm_FreelanceAddMount and cm_FreelanceAddSymlink is supposed to
return the allocated FID of the entry that was added.  However,
cm_NameI is called to perform the lookup without forcing an update
of the Freelance fake directory.  As a result the entry may not be
found.

Force an update prior to calling cm_NameI() by using
cm_clearLocalMountPointChange() and cm_reInitLocalMountPoints()
if required.

LICENSE MIT

Change-Id: I08147b2ec61c810fdc718964362315af67d485b8
Reviewed-on: http://gerrit.openafs.org/1890
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/cm_freelance.c

index 4343de5..fae89d9 100644 (file)
@@ -1095,6 +1095,12 @@ long cm_FreelanceAddMount(char *filename, char *cellname, char *volume, int rw,
         cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL);        
         if (!cpath)
             return CM_ERROR_NOSUCHPATH;
+
+        if (cm_getLocalMountPointChange()) {   // check for changes
+            cm_clearLocalMountPointChange();    // clear the changefile
+            cm_reInitLocalMountPoints();       // start reinit
+        }
+
         code = cm_NameI(cm_data.rootSCachep, cpath,
                         CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL,
                         cm_rootUserp, NULL, &req, &scp);
@@ -1322,6 +1328,12 @@ long cm_FreelanceAddSymlink(char *filename, char *destination, cm_fid_t *fidp)
         cpath = cm_FsStringToClientStringAlloc(filename, -1, NULL);        
         if (!cpath)
             return CM_ERROR_NOSUCHPATH;
+
+        if (cm_getLocalMountPointChange()) {   // check for changes
+            cm_clearLocalMountPointChange();    // clear the changefile
+            cm_reInitLocalMountPoints();       // start reinit
+        }
+
         code = cm_NameI(cm_data.rootSCachep, cpath,
                         CM_FLAG_FOLLOW | CM_FLAG_CASEFOLD | CM_FLAG_DFS_REFERRAL,
                         cm_rootUserp, NULL, &req, &scp);