Windows: use interlocked increment on cm_buf_t refcnt
authorJeffrey Altman <jaltman@your-file-system.com>
Fri, 2 Dec 2011 18:21:24 +0000 (13:21 -0500)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Fri, 2 Dec 2011 23:53:51 +0000 (15:53 -0800)
For consistency use interlocked increment when setting the
cm_buf_t refCnt to 1 even though it is protected by a lock.

Change-Id: I91fbb1469715ee6b7d6f94f416c59ebcd1645336
Reviewed-on: http://gerrit.openafs.org/6175
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Jeffrey Altman <jaltman@secure-endpoints.com>
Tested-by: Jeffrey Altman <jaltman@secure-endpoints.com>

src/WINNT/afsd/cm_buf.c

index ac402f5..142342d 100644 (file)
@@ -1474,7 +1474,7 @@ long buf_GetNewLocked(struct cm_scache *scp, osi_hyper_t *offsetp, cm_req_t *req
             buf_DecrementFreeCount();
 
             /* prepare to return it.  Give it a refcount */
-            bp->refCount = 1;
+            InterlockedIncrement(&bp->refCount);
 #ifdef DEBUG_REFCOUNT
             osi_Log2(afsd_logp,"buf_GetNewLocked bp 0x%p ref %d", bp, 1);
             afsi_log("%s:%d buf_GetNewLocked bp 0x%p, ref %d", __FILE__, __LINE__, bp, 1);