viced: lockcount only valid if not expired
authorJeffrey Altman <jaltman@your-file-system.com>
Mon, 20 Feb 2012 06:40:03 +0000 (01:40 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Tue, 21 Feb 2012 02:07:53 +0000 (18:07 -0800)
locks are issued on a lease.  If the lock is expired, the lock
count is zero.

Change-Id: I628dd5b8b0d38694d653d9e8e82ff60ec2e1505c
Reviewed-on: http://gerrit.openafs.org/6740
Reviewed-by: Derrick Brashear <shadow@dementix.org>
Reviewed-by: Alistair Ferguson <alistair.ferguson@mac.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/viced/afsfileprocs.c

index 730d371..dabcbbe 100644 (file)
@@ -2131,6 +2131,8 @@ static
 GetStatus(Vnode * targetptr, AFSFetchStatus * status, afs_int32 rights,
          afs_int32 anyrights, Vnode * parentptr)
 {
+    int Time =FT_ApproxTime();
+
     /* initialize return status from a vnode  */
     status->InterfaceVersion = 1;
     status->SyncCounter = status->dataVersionHigh = status->lockCount =
@@ -2165,7 +2167,7 @@ GetStatus(Vnode * targetptr, AFSFetchStatus * status, afs_int32 rights,
         Directory ? targetptr->disk.uniquifier : parentptr->disk.uniquifier);
     status->ServerModTime = targetptr->disk.serverModifyTime;
     status->Group = targetptr->disk.group;
-    status->lockCount = targetptr->disk.lock.lockCount;
+    status->lockCount = Time > targetptr->disk.lock.lockTime ? targetptr->disk.lock.lockCount : 0;
     status->errorCode = 0;
 
 }                              /*GetStatus */