Skip to content

Commit fe53e04

Browse files
committed
nfs client: switch nfs_advlock() to use exclusive vnode lock
It eliminates the need to upgrade the lock in the function. More importantly, the calls to nfs_advlock_p()/nlm_advlock() sometimes flush buffers, which requires exclusive locking. Reported and tested by: bz Reviewed by: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D52195
1 parent ef73953 commit fe53e04

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

sys/fs/nfsclient/nfs_clvnops.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3474,7 +3474,7 @@ nfs_advlock(struct vop_advlock_args *ap)
34743474
u_quad_t size;
34753475
struct nfsmount *nmp;
34763476

3477-
error = NFSVOPLOCK(vp, LK_SHARED);
3477+
error = NFSVOPLOCK(vp, LK_EXCLUSIVE);
34783478
if (error != 0)
34793479
return (EBADF);
34803480
nmp = VFSTONFS(vp->v_mount);
@@ -3511,11 +3511,6 @@ nfs_advlock(struct vop_advlock_args *ap)
35113511
cred = p->p_ucred;
35123512
else
35133513
cred = td->td_ucred;
3514-
NFSVOPLOCK(vp, LK_UPGRADE | LK_RETRY);
3515-
if (VN_IS_DOOMED(vp)) {
3516-
error = EBADF;
3517-
goto out;
3518-
}
35193514

35203515
/*
35213516
* If this is unlocking a write locked region, flush and

0 commit comments

Comments
 (0)