FBSD: Handle 1-argument VOP_UNLOCK

FreeBSD commit b249ce48ea5560afdcff57e72a9880b7d3132434 (vfs: drop the
mostly unused flags argument from VOP_UNLOCK) removed the second
argument to VOP_UNLOCK(). Change all callers to go through a
AFS_VOP_UNLOCK() wrapper, and use the 1-argument version when
appropriate. Get rid of the extra unlock_vnode() wrapper in osi_vm.c;
one layer of indirection is enough.

Change-Id: I9929833bb567391a2a1df95a41a3772cdaf4da2c
Reviewed-on: https://gerrit.openafs.org/15164
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Michael Meffie <mmeffie@sinenomine.net>
Reviewed-by: Andrew Deason <adeason@sinenomine.net>
This commit is contained in:
Andrew Deason 2022-10-25 13:28:51 -05:00
parent bc55f8a99b
commit 2c208c2662
10 changed files with 20 additions and 16 deletions

View File

@ -42,7 +42,7 @@ osi_UFSOpen(afs_dcache_id_t *ainode)
osi_FreeSmallSpace(afile);
osi_Panic("UFSOpen: igetinode failed");
}
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
afile->vnode = vp;
afile->size = VTOI(vp)->i_size;
afile->offset = 0;
@ -59,7 +59,7 @@ afs_osi_Stat(struct osi_file *afile, struct osi_stat *astat)
AFS_GUNLOCK();
vn_lock(afile->vnode, LK_EXCLUSIVE | LK_RETRY);
code = VOP_GETATTR(afile->vnode, &tvattr, afs_osi_credp);
VOP_UNLOCK(afile->vnode, 0);
AFS_VOP_UNLOCK(afile->vnode);
AFS_GLOCK();
if (code == 0) {
astat->size = tvattr.va_size;
@ -108,7 +108,7 @@ osi_UFSTruncate(struct osi_file *afile, afs_int32 asize)
code = VOP_SETATTR(vp, &tvattr, afs_osi_credp);
out:
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
if (glocked)
AFS_GLOCK();
return code;

View File

@ -47,8 +47,6 @@ osi_lookupname(char *aname, enum uio_seg seg, int followlink,
return error;
}
*vpp = n.ni_vp;
/* XXX should we do this? Usually NOT (matt) */
/*VOP_UNLOCK(n.ni_vp, 0);*/
NDFREE(&n, NDF_ONLY_PNBUF);
if (glocked)
AFS_GLOCK();

View File

@ -59,7 +59,7 @@ osi_TryEvictVCache(struct vcache *avc, int *slept, int defersleep)
evicted = 1;
}
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
}
vdrop(vp);
@ -103,7 +103,7 @@ osi_AttachVnode(struct vcache *avc, int seq)
if (!vp->v_mount) {
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY); /* !glocked */
insmntque(vp, afs_globalVFS);
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
}
AFS_GLOCK();
ObtainWriteLock(&afs_xvcache,339);

View File

@ -50,7 +50,6 @@
#define lock_vnode(v, f) vn_lock((v), (f))
#define ilock_vnode(v) vn_lock((v), LK_INTERLOCK|LK_EXCLUSIVE|LK_RETRY)
#define unlock_vnode(v) VOP_UNLOCK((v), 0)
#define islocked_vnode(v) VOP_ISLOCKED((v))
#if __FreeBSD_version >= 1000030
@ -209,7 +208,7 @@ osi_VM_TryToSmush(struct vcache *avc, afs_ucred_t *acred, int sync)
if (islocked == LK_SHARED)
lock_vnode(vp, LK_DOWNGRADE);
else if (!islocked)
unlock_vnode(vp);
AFS_VOP_UNLOCK(vp);
AFS_GLOCK();
}

View File

@ -244,7 +244,7 @@ afs_vop_lookup(ap)
*/
if (flags & ISDOTDOT)
VOP_UNLOCK(dvp, 0);
AFS_VOP_UNLOCK(dvp);
AFS_GLOCK();
error = afs_lookup(VTOAFS(dvp), name, &vcp, cnp->cn_cred);
@ -883,7 +883,7 @@ afs_vop_link(ap)
error = afs_link(VTOAFS(vp), VTOAFS(dvp), name, cnp->cn_cred);
AFS_GUNLOCK();
if (dvp != vp)
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
out:
DROPNAME();
return error;
@ -1189,7 +1189,7 @@ afs_vop_reclaim(struct vop_reclaim_args *ap)
* the vnode lock, and we need afs_xvcache. So drop the vnode lock in order
* to hold afs_xvcache.
*/
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
if (!haveGlock)
AFS_GLOCK();

View File

@ -563,7 +563,7 @@ afs_UFSReadUIO(afs_dcache_id_t *cacheId, struct uio *tuiop)
AFS_GUNLOCK();
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE);
code = VOP_READ(tfile->vnode, tuiop, 0, afs_osi_credp);
VOP_UNLOCK(tfile->vnode, 0);
AFS_VOP_UNLOCK(tfile->vnode);
AFS_GLOCK();
#elif defined(AFS_NBSD_ENV)
tuiop->uio_rw = UIO_READ;

View File

@ -164,7 +164,7 @@ afs_UFSWriteUIO(struct vcache *avc, afs_dcache_id_t *inode, struct uio *tuiop)
AFS_GUNLOCK();
VOP_LOCK(tfile->vnode, LK_EXCLUSIVE);
code = VOP_WRITE(tfile->vnode, tuiop, 0, afs_osi_credp);
VOP_UNLOCK(tfile->vnode, 0);
AFS_VOP_UNLOCK(tfile->vnode);
AFS_GLOCK();
#elif defined(AFS_NBSD_ENV)
AFS_GUNLOCK();

View File

@ -1251,7 +1251,7 @@ afs_syscall_pioctl(char *path, unsigned int com, caddr_t cmarg, int follow)
#else
#if defined(AFS_FBSD_ENV)
if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE)
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
#endif /* AFS_FBSD_ENV */
AFS_RELE(vp); /* put vnode back */
#endif

View File

@ -1856,7 +1856,7 @@ afs_GetVCache(struct VenusFid *afid, struct vrequest *areq)
}
vinvalbuf(vp, V_SAVE, PINOD, 0); /* changed late in 8.0-CURRENT */
if (!iheldthelock)
VOP_UNLOCK(vp, 0);
AFS_VOP_UNLOCK(vp);
AFS_GLOCK();
# elif defined(AFS_OBSD_ENV)
iheldthelock = VOP_ISLOCKED(vp, curproc);

View File

@ -135,6 +135,13 @@ enum vcexcl { NONEXCL, EXCL };
# define AFS_IS_DOOMED(vp) (((vp)->v_iflag & VI_DOOMED) != 0)
#endif
/* r356337 dropped the 'flags' arg from VOP_UNLOCK */
#if __FreeBSD_version >= 1300074
# define AFS_VOP_UNLOCK(vp) VOP_UNLOCK(vp)
#else
# define AFS_VOP_UNLOCK(vp) VOP_UNLOCK(vp, 0)
#endif
#else /* !defined(UKERNEL) */
/* This section for user space compiles only */