svn commit: r193837 - head/sys/fs/nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Tue Jun 9 15:18:02 UTC 2009
Author: rmacklem
Date: Tue Jun 9 15:18:01 2009
New Revision: 193837
URL: http://svn.freebsd.org/changeset/base/193837
Log:
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)
Modified:
head/sys/fs/nfsclient/nfs_clvnops.c
Modified: head/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvnops.c Tue Jun 9 15:10:00 2009 (r193836)
+++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Jun 9 15:18:01 2009 (r193837)
@@ -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);
More information about the svn-src-all
mailing list