Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 May 2011 22:05:35 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r222329 - head/sys/fs/nfsclient
Message-ID:  <201105262205.p4QM5ZGO082641@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Thu May 26 22:05:35 2011
New Revision: 222329
URL: http://svn.freebsd.org/changeset/base/222329

Log:
  Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()
  in the new NFS client so that a forced dismount doesn't
  get stuck in the VFS_SYNC() call that happens before
  VFS_UNMOUNT() in dounmount().
  Additional changes are needed before forced dismounts will work.
  
  MFC after:	2 weeks

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

Modified: head/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clvfsops.c	Thu May 26 20:54:45 2011	(r222328)
+++ head/sys/fs/nfsclient/nfs_clvfsops.c	Thu May 26 22:05:35 2011	(r222329)
@@ -1458,10 +1458,20 @@ nfs_sync(struct mount *mp, int waitfor)
 
 	td = curthread;
 
+	MNT_ILOCK(mp);
+	/*
+	 * If a forced dismount is in progress, return from here so that
+	 * the umount(2) syscall doesn't get stuck in VFS_SYNC() before
+	 * calling VFS_UNMOUNT().
+	 */
+	if ((mp->mnt_kern_flag & MNTK_UNMOUNTF) != 0) {
+		MNT_IUNLOCK(mp);
+		return (EBADF);
+	}
+
 	/*
 	 * Force stale buffer cache information to be flushed.
 	 */
-	MNT_ILOCK(mp);
 loop:
 	MNT_VNODE_FOREACH(vp, mp, mvp) {
 		VI_LOCK(vp);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201105262205.p4QM5ZGO082641>