From ab4e008a3b357644c1f16ebc63ea2fae5270243c Mon Sep 17 00:00:00 2001 From: Ben Kaduk Date: Fri, 29 Oct 2010 12:01:04 -0400 Subject: [PATCH] FBSD: lock interlock around v_usecount accesses The FreeBSD vnode locking strategy requires that the vnode interlock be held for all accesses to v_usecount, such as those used by our VREFCOUNT and VREFCOUNT_GT macros. Conveniently, a wrapper function is provided that takes the lock around its access of the element, vrefcnt(). Use it for our macros. Reviewed-on: http://gerrit.openafs.org/3195 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit b6367aa84b9d1c7529b6f3a12bbfeacc91384ffb) Change-Id: I41ccb2b84347c4182d5b782faee176c9800d640a Reviewed-on: http://gerrit.openafs.org/3234 Tested-by: BuildBot --- src/afs/afs.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/afs/afs.h b/src/afs/afs.h index 1a2dc9de2..9561dde50 100644 --- a/src/afs/afs.h +++ b/src/afs/afs.h @@ -656,6 +656,9 @@ struct SimpleLocks { #if defined(AFS_DARWIN80_ENV) #define VREFCOUNT_GT(v, y) vnode_isinuse(AFSTOV(v), (y)) +#elif defined(AFS_FBSD_ENV) +#define VREFCOUNT(v) (vrefcnt(AFSTOV(v))) +#define VREFCOUNT_GT(v, y) (vrefcnt(AFSTOV(v)) > y) #elif defined(AFS_XBSD_ENV) || defined(AFS_DARWIN_ENV) #define VREFCOUNT(v) ((v)->vrefCount) #define VREFCOUNT_GT(v, y) (AFSTOV(v)->v_usecount > (y)) -- 2.39.5