/* and other stuff */
scp->parentVnode = statusp->ParentVnode;
scp->parentUnique = statusp->ParentUnique;
- scp->fsLockCount = statusp->lockCount;
+
+ /* -1 is a write lock; any positive values are read locks */
+ scp->fsLockCount = (afs_int32)statusp->lockCount;
/* and merge in the private acl cache info, if this is more than the public
* info; merge in the public stuff in any case.
have CM_FILELOCK_FLAG_CLIENTONLY
set. */
- afs_uint32 fsLockCount; /* number of locks held as reported
+ afs_int32 fsLockCount; /* number of locks held as reported
* by the file server in the most
- * recent fetch status.
+ * recent fetch status. Updated by
+ * the locks known to have been acquired
+ * or released by this client.
*/
/* bulk stat progress */
osi_Log0(afsd_logp, "CALL SetLock SUCCESS");
}
- lock_ObtainWrite(&scp->rw);
reqp->flags = reqflags;
+
+ lock_ObtainWrite(&scp->rw);
+ if (code == 0) {
+ /*
+ * The file server does not return a status structure so we must
+ * locally track the file server lock count to the best of our
+ * ability.
+ */
+ if (lockType == LockWrite)
+ scp->fsLockCount = -1;
+ else
+ scp->fsLockCount++;
+ }
return code;
}
"CALL ReleaseLock SUCCESS");
lock_ObtainWrite(&scp->rw);
+ if (code == 0) {
+ /*
+ * The file server does not return a status structure so we must
+ * locally track the file server lock count to the best of our
+ * ability.
+ */
+ scp->fsLockCount--;
+ if (scp->fsLockCount < 0)
+ scp->fsLockCount = 0;
+ }
return (code != CM_ERROR_BADFD ? code : 0);
}
if (code) {
osi_Log1(afsd_logp, "CALL ExtendLock FAILURE, code 0x%x", code);
+ scp->fsLockCount = 0;
} else {
osi_Log0(afsd_logp, "CALL ExtendLock SUCCESS");
scp->lockDataVersion = scp->dataVersion;