nfs_clvnops.c: Fix access to v_mount when vnode unlocked
Commit ab17854f974b fixed access to v_mount when the vnode is unlocked for nfs_copy_file_range(). This patch does the same for nfs_ioctl(). Reviewed by: kib, markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D36846
This commit is contained in:
parent
7c40e2d5f6
commit
bffb3d947b
@ -4111,14 +4111,6 @@ nfs_ioctl(struct vop_ioctl_args *ap)
|
||||
int attrflag, content, error, ret;
|
||||
bool eof = false; /* shut up compiler. */
|
||||
|
||||
if (vp->v_type != VREG)
|
||||
return (ENOTTY);
|
||||
nmp = VFSTONFS(vp->v_mount);
|
||||
if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION) {
|
||||
error = vop_stdioctl(ap);
|
||||
return (error);
|
||||
}
|
||||
|
||||
/* Do the actual NFSv4.2 RPC. */
|
||||
switch (ap->a_command) {
|
||||
case FIOSEEKDATA:
|
||||
@ -4134,6 +4126,18 @@ nfs_ioctl(struct vop_ioctl_args *ap)
|
||||
error = vn_lock(vp, LK_SHARED);
|
||||
if (error != 0)
|
||||
return (EBADF);
|
||||
|
||||
if (vp->v_type != VREG) {
|
||||
VOP_UNLOCK(vp);
|
||||
return (ENOTTY);
|
||||
}
|
||||
nmp = VFSTONFS(vp->v_mount);
|
||||
if (!NFSHASNFSV4(nmp) || nmp->nm_minorvers < NFSV42_MINORVERSION) {
|
||||
VOP_UNLOCK(vp);
|
||||
error = vop_stdioctl(ap);
|
||||
return (error);
|
||||
}
|
||||
|
||||
attrflag = 0;
|
||||
if (*((off_t *)ap->a_data) >= VTONFS(vp)->n_size)
|
||||
error = ENXIO;
|
||||
|
Loading…
x
Reference in New Issue
Block a user