Author: rmacklem
Date: Wed Jun 10 21:16:39 2009
New Revision: 193955
URL: http://svn.freebsd.org/changeset/base/193955

Log:
  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)

Modified:
  head/sys/fs/nfsclient/nfs_clbio.c

Modified: head/sys/fs/nfsclient/nfs_clbio.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clbio.c   Wed Jun 10 21:06:07 2009        
(r193954)
+++ head/sys/fs/nfsclient/nfs_clbio.c   Wed Jun 10 21:16:39 2009        
(r193955)
@@ -485,6 +485,11 @@ nfs_bioread_check_cons(struct vnode *vp,
         * 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 flag
 
        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 flag
        }
 
        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.
         */
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to