]> git.michaelhowe.org Git - packages/o/openafs.git/commitdiff
Windows: Add cm_SyncOp to cm_ReadMountPoint()
authorJeffrey Altman <jaltman@your-file-system.com>
Sun, 14 Oct 2012 19:46:06 +0000 (15:46 -0400)
committerJeffrey Altman <jaltman@your-file-system.com>
Fri, 19 Oct 2012 09:49:27 +0000 (02:49 -0700)
Add a cm_SyncOp(CM_SCACHESYNC_FETCHDATA) call to cm_ReadMountPoint()
to prevent multiple FetchData RPCs being issued for the same
mount point at the same time.

Change-Id: I7651f4505727289d800af060cc3ff5a5f449f447
Reviewed-on: http://gerrit.openafs.org/8235
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@your-file-system.com>
Tested-by: Jeffrey Altman <jaltman@your-file-system.com>
src/WINNT/afsd/cm_vnodeops.c

index 2fc73bdc9cf7204288ef4350d4427a8dd7de86f0..a9f6eadac6e8bccae25c1ad69fc29c9151e3695a 100644 (file)
@@ -836,11 +836,17 @@ long cm_LookupSearchProc(cm_scache_t *scp, cm_dirEntry_t *dep, void *rockp,
  */
 long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
 {
-    long code;
+    long code = 0;
+
+    code = cm_SyncOp(scp, NULL, userp, reqp, 0, CM_SCACHESYNC_FETCHDATA);
+    if (code)
+        return code;
 
     if (scp->mountPointStringp[0] &&
-        scp->mpDataVersion == scp->dataVersion)
-        return 0;
+         scp->mpDataVersion == scp->dataVersion) {
+        code = 0;
+        goto done;
+    }
 
 #ifdef AFS_FREELANCE_CLIENT
     /* File servers do not have data for freelance entries */
@@ -859,17 +865,22 @@ long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
         offset.LowPart = offset.HighPart = 0;
         code = cm_GetData(scp, &offset, temp, MOUNTPOINTLEN, userp, reqp);
         if (code)
-            return code;
+            goto done;
 
         /*
          * scp->length is the actual length of the mount point string.
          * It is current because cm_GetData merged the most up to date
          * status info into scp and has not dropped the rwlock since.
          */
-        if (scp->length.LowPart > MOUNTPOINTLEN - 1)
-            return CM_ERROR_TOOBIG;
-        if (scp->length.LowPart == 0)
-            return CM_ERROR_INVAL;
+        if (scp->length.LowPart > MOUNTPOINTLEN - 1) {
+            code = CM_ERROR_TOOBIG;
+            goto done;
+        }
+
+        if (scp->length.LowPart == 0) {
+            code = CM_ERROR_INVAL;
+            goto done;
+        }
 
         /* convert the terminating dot to a NUL */
         temp[scp->length.LowPart - 1] = 0;
@@ -877,6 +888,9 @@ long cm_ReadMountPoint(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp)
         scp->mpDataVersion = scp->dataVersion;
     }
 
+  done:
+    cm_SyncOpDone(scp, NULL, CM_SCACHESYNC_FETCHDATA);
+
     return code;
 }