summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorrmacklem <rmacklem@FreeBSD.org>2009-06-10 21:16:39 +0000
committerrmacklem <rmacklem@FreeBSD.org>2009-06-10 21:16:39 +0000
commitb56aefcee221ccfd586fb13a66819d485b40f024 (patch)
tree3afcbc4a855fc509806b545665cf435f350bd53d /sys
parent386037883c750d04fd9639a5f731520b8060fce1 (diff)
downloadFreeBSD-src-b56aefcee221ccfd586fb13a66819d485b40f024.zip
FreeBSD-src-b56aefcee221ccfd586fb13a66819d485b40f024.tar.gz
This commit is analagous to r193952, but for the experimental nfs
subsystem. Add a test for VI_DOOMED just after ncl_upgrade_vnlock() in ncl_bioread_check_cons(). This is required since it is possible for the vnode to be vgonel()'d while in ncl_upgrade_vnlock() when a forced dismount is in progress. Also, move the check for VI_DOOMED in ncl_vinvalbuf() down to after ncl_upgrade_vnlock() and replace the out of date comment for it. Approved by: kib (mentor)
Diffstat (limited to 'sys')
-rw-r--r--sys/fs/nfsclient/nfs_clbio.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/sys/fs/nfsclient/nfs_clbio.c b/sys/fs/nfsclient/nfs_clbio.c
index 78ae96c..b355e60 100644
--- a/sys/fs/nfsclient/nfs_clbio.c
+++ b/sys/fs/nfsclient/nfs_clbio.c
@@ -485,6 +485,11 @@ nfs_bioread_check_cons(struct vnode *vp, struct thread *td, struct ucred *cred)
* But for now, this suffices.
*/
old_lock = ncl_upgrade_vnlock(vp);
+ if (vp->v_iflag & VI_DOOMED) {
+ ncl_downgrade_vnlock(vp, old_lock);
+ return (EBADF);
+ }
+
mtx_lock(&np->n_mtx);
if (np->n_flag & NMODIFIED) {
mtx_unlock(&np->n_mtx);
@@ -1391,14 +1396,6 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg)
ASSERT_VOP_LOCKED(vp, "ncl_vinvalbuf");
- /*
- * XXX This check stops us from needlessly doing a vinvalbuf when
- * being called through vclean(). It is not clear that this is
- * unsafe.
- */
- if (vp->v_iflag & VI_DOOMED)
- return (0);
-
if ((nmp->nm_flag & NFSMNT_INT) == 0)
intrflg = 0;
if ((nmp->nm_mountp->mnt_kern_flag & MNTK_UNMOUNTF))
@@ -1412,6 +1409,16 @@ ncl_vinvalbuf(struct vnode *vp, int flags, struct thread *td, int intrflg)
}
old_lock = ncl_upgrade_vnlock(vp);
+ if (vp->v_iflag & VI_DOOMED) {
+ /*
+ * Since vgonel() uses the generic vinvalbuf() to flush
+ * dirty buffers and it does not call this function, it
+ * is safe to just return OK when VI_DOOMED is set.
+ */
+ ncl_downgrade_vnlock(vp, old_lock);
+ return (0);
+ }
+
/*
* Now, flush as required.
*/
OpenPOWER on IntegriCloud