From a03f1960da3a68cd8453960302be0319a7bb45ae Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 2 Aug 2010 16:06:39 -0400 Subject: [PATCH] Windows: When processing pioctl paths ensure callbacks are obtained 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 Tested-by: BuildBot Reviewed-by: Derrick Brashear Reviewed-by: Jeffrey Altman --- src/WINNT/afsd/smb_ioctl.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/src/WINNT/afsd/smb_ioctl.c b/src/WINNT/afsd/smb_ioctl.c index 1cfdceb138..c2750a59a4 100644 --- a/src/WINNT/afsd/smb_ioctl.c +++ b/src/WINNT/afsd/smb_ioctl.c @@ -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; }