mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-17 10:26:15 +00:00
In nfs_lock(), recheck vp->v_data after lock before accessing it.
We might race with reclaim, and then this is no longer a nfs vnode, in which case we do not need to handle deferred vnode_pager_setsize() either. Reported by: rk@ronald.org PR: 242184 Sponsored by: The FreeBSD Foundation MFC after: 3 days
This commit is contained in:
parent
0b0c23fee3
commit
9698d99230
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=355210
@ -312,6 +312,8 @@ nfs_lock(struct vop_lock1_args *ap)
|
||||
if (error != 0 || vp->v_op != &newnfs_vnodeops)
|
||||
return (error);
|
||||
np = VTONFS(vp);
|
||||
if (np == NULL)
|
||||
return (0);
|
||||
NFSLOCKNODE(np);
|
||||
if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED &&
|
||||
lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE &&
|
||||
@ -345,6 +347,9 @@ nfs_lock(struct vop_lock1_args *ap)
|
||||
error = VOP_LOCK1_APV(&default_vnodeops, ap);
|
||||
if (error != 0 || vp->v_op != &newnfs_vnodeops)
|
||||
return (error);
|
||||
if (vp->v_data == NULL)
|
||||
goto downgrade;
|
||||
MPASS(vp->v_data == np);
|
||||
NFSLOCKNODE(np);
|
||||
if ((np->n_flag & NVNSETSZSKIP) == 0) {
|
||||
NFSUNLOCKNODE(np);
|
||||
|
Loading…
Reference in New Issue
Block a user