Since vn_lock() with the LK_RETRY flag never returns an error
for FreeBSD-CURRENT, the code that checked for and returned the error was broken. Change it to check for VI_DOOMED set after vn_lock() and return an error for that case. I believe this should only happen for forced dismounts. Approved by: kib (mentor)
This commit is contained in:
parent
4ef60d2686
commit
410654ec1b
@ -2726,14 +2726,16 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
struct proc *p = (struct proc *)ap->a_id;
|
||||
struct thread *td = curthread; /* XXX */
|
||||
struct vattr va;
|
||||
int ret, error = EOPNOTSUPP, vlret;
|
||||
int ret, error = EOPNOTSUPP;
|
||||
u_quad_t size;
|
||||
|
||||
if (NFS_ISV4(vp) && (ap->a_flags & F_POSIX)) {
|
||||
cred = p->p_ucred;
|
||||
vlret = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vlret)
|
||||
return (vlret);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vp->v_iflag & VI_DOOMED) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (EBADF);
|
||||
}
|
||||
|
||||
/*
|
||||
* If this is unlocking a write locked region, flush and
|
||||
@ -2757,9 +2759,11 @@ nfs_advlock(struct vop_advlock_args *ap)
|
||||
error = nfs_catnap(PZERO | PCATCH, "ncladvl");
|
||||
if (error)
|
||||
return (EINTR);
|
||||
vlret = vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vlret)
|
||||
return (vlret);
|
||||
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY);
|
||||
if (vp->v_iflag & VI_DOOMED) {
|
||||
VOP_UNLOCK(vp, 0);
|
||||
return (EBADF);
|
||||
}
|
||||
}
|
||||
} while (ret == NFSERR_DENIED && (ap->a_flags & F_WAIT) &&
|
||||
ap->a_op == F_SETLK);
|
||||
|
Loading…
x
Reference in New Issue
Block a user