Windows: When processing pioctl paths ensure callbacks are obtained
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 2 Aug 2010 20:06:39 +0000 (16:06 -0400)
committerJeffrey Altman <jaltman@openafs.org>
Tue, 3 Aug 2010 11:58:38 +0000 (04:58 -0700)
When processing a pioctl path with either smb_ParseIoctlPath or
smb_ParseIoctlParent, cm_SyncOp(CM_SCACHESYNC_NEEDCALLBACK|GETSTATUS)
must be called on the cm_scache_t object to ensure that it is up
to date before we permit cm_Lookup or other operations to be performed
on it.  Add the cm_SyncOp() call to smb_ParseIoctlPath and
smb_ParseIoctlParent to ensure it is done for all pioctl operations.

LICENSE MIT

Change-Id: I2fe5d5ec2567693155277b40929dedb8155d9ebf
Reviewed-on: http://gerrit.openafs.org/2504
Tested-by: Jeffrey Altman <jaltman@openafs.org>
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Jeffrey Altman <jaltman@openafs.org>

src/WINNT/afsd/smb_ioctl.c

index 1cfdceb..c2750a5 100644 (file)
@@ -753,11 +753,19 @@ smb_ParseIoctlPath(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
     if (substRootp)
        cm_ReleaseSCache(substRootp);
 
-    /* and return success */
-    osi_Log1(afsd_logp,"cm_ParseIoctlPath [8] code 0x%x", code);
-
     if (relativePath)
         free(relativePath);
+
+    /* Ensure that the status object is up to date */
+    lock_ObtainWrite(&(*scpp)->rw);
+    code = cm_SyncOp( *scpp, NULL, userp, reqp, 0,
+                      CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+    if (code == 0)
+        cm_SyncOpDone( *scpp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+    lock_ReleaseWrite(&(*scpp)->rw);
+
+    /* and return success */
+    osi_Log1(afsd_logp,"cm_ParseIoctlPath [8] code 0x%x", code);
     return 0;
 }
 
@@ -920,6 +928,14 @@ smb_ParseIoctlParent(smb_ioctl_t *ioctlp, cm_user_t *userp, cm_req_t *reqp,
     code = (long)strlen(ioctlp->ioctl.inDatap) + 1;
     ioctlp->ioctl.inDatap += code;
 
+    /* Ensure that the status object is up to date */
+    lock_ObtainWrite(&(*scpp)->rw);
+    code = cm_SyncOp( *scpp, NULL, userp, reqp, 0,
+                      CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+    if (code == 0)
+        cm_SyncOpDone( *scpp, NULL, CM_SCACHESYNC_NEEDCALLBACK | CM_SCACHESYNC_GETSTATUS);
+    lock_ReleaseWrite(&(*scpp)->rw);
+
     /* and return success */
     return 0;
 }