From owner-svn-src-all@FreeBSD.ORG Wed Jun 10 21:16:39 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id C50B9106564A; Wed, 10 Jun 2009 21:16:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id B398A8FC18; Wed, 10 Jun 2009 21:16:39 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n5ALGdSI026319; Wed, 10 Jun 2009 21:16:39 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n5ALGdbK026318; Wed, 10 Jun 2009 21:16:39 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <200906102116.n5ALGdbK026318@svn.freebsd.org> From: Rick Macklem Date: Wed, 10 Jun 2009 21:16:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r193955 - head/sys/fs/nfsclient X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Jun 2009 21:16:40 -0000 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. */