Windows: RDR_InvalidateObject do not hold locks
[openafs.git] / src / WINNT / afsd / cm_buf.c
index 2377df2..88e4eb2 100644 (file)
@@ -1898,6 +1898,7 @@ long buf_Truncate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp,
     long code;
     long bufferPos;
     afs_uint32 i;
+    afs_uint32 invalidate = 0;
 
     /* assert that cm_bufCreateLock is held in write mode */
     lock_AssertWrite(&scp->bufCreateLock);
@@ -1968,10 +1969,7 @@ long buf_Truncate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp,
                         lock_ReleaseWrite(&buf_globalLock);
                     }
                 } else {
-                    if (RDR_Initialized)
-                        RDR_InvalidateObject(scp->fid.cell, scp->fid.volume, scp->fid.vnode,
-                                             scp->fid.unique, scp->fid.hash,
-                                             scp->fileType, AFS_INVALIDATE_SMB);
+                    invalidate = 1;
                 }
                 _InterlockedAnd(&bufp->flags, ~CM_BUF_DIRTY);
                 bufp->error = 0;
@@ -2020,6 +2018,11 @@ long buf_Truncate(cm_scache_t *scp, cm_user_t *userp, cm_req_t *reqp,
     buf_ValidateBufQueues();
 #endif /* TESTING */
 
+    if (invalidate && RDR_Initialized)
+        RDR_InvalidateObject(scp->fid.cell, scp->fid.volume, scp->fid.vnode,
+                             scp->fid.unique, scp->fid.hash,
+                             scp->fileType, AFS_INVALIDATE_SMB);
+
     /* done */
     return code;
 }