Bug 157365 - [nfs] cannot umount an nfs from dead server
Summary: [nfs] cannot umount an nfs from dead server
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 8.2-RELEASE
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-fs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-27 09:10 UTC by Eugene M. Zheganin
Modified: 2011-06-17 19:28 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene M. Zheganin 2011-05-27 09:10:09 UTC
cannot umount an nfs from dead server.

umount hangs indefinitely. so does umount -f.

Fix: 

Bring the server back from the dead or simply go back in time. Or reboot.
Sometimes going back in time is more likely since reboot is not even
possible.
How-To-Repeat: Mount an FNS resource, disconnect the server from the network, try to
umount resource.
Comment 1 Mark Linimon freebsd_committer freebsd_triage 2011-05-27 15:05:12 UTC
Responsible Changed
From-To: freebsd-bugs->freebsd-fs

Over to maintainer(s).
Comment 2 dfilter service freebsd_committer freebsd_triage 2011-05-29 21:55:36 UTC
Author: rmacklem
Date: Sun May 29 20:55:23 2011
New Revision: 222464
URL: http://svn.freebsd.org/changeset/base/222464

Log:
  Add a check for MNTK_UNMOUNTF at the beginning of nfs_sync()
  in the old NFS client so that a forced dismount doesn't
  get stuck in the VFS_SYNC() call that happens before
  VFS_UNMOUNT() in dounmount(). Analagous to r222329 for the new NFS client.
  An additional change is needed before forced dismounts will work.
  
  PR:		kern/157365
  MFC after:	2 weeks

Modified:
  head/sys/nfsclient/nfs_vfsops.c

Modified: head/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- head/sys/nfsclient/nfs_vfsops.c	Sun May 29 20:46:53 2011	(r222463)
+++ head/sys/nfsclient/nfs_vfsops.c	Sun May 29 20:55:23 2011	(r222464)
@@ -1408,10 +1408,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);
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 3 dfilter service freebsd_committer freebsd_triage 2011-05-29 22:14:07 UTC
Author: rmacklem
Date: Sun May 29 21:13:53 2011
New Revision: 222466
URL: http://svn.freebsd.org/changeset/base/222466

Log:
  Modify the umount(8) command so that it doesn't do
  a sync(2) syscall before unmount(2) for the "-f" case.
  This avoids a forced dismount from getting stuck for
  an NFS mountpoint in sync() when the server is not
  responsive. With this commit, forced dismounts should
  normally work for the NFS clients, but can take up to
  about 1minute to complete.
  
  PR:		kern/157365
  Reviewed by:	kib
  MFC after:	2 weeks

Modified:
  head/sbin/umount/umount.c

Modified: head/sbin/umount/umount.c
==============================================================================
--- head/sbin/umount/umount.c	Sun May 29 21:03:40 2011	(r222465)
+++ head/sbin/umount/umount.c	Sun May 29 21:13:53 2011	(r222466)
@@ -90,9 +90,6 @@ main(int argc, char *argv[])
 	struct statfs *mntbuf, *sfs;
 	struct addrinfo hints;
 
-	/* Start disks transferring immediately. */
-	sync();
-
 	all = errs = 0;
 	while ((ch = getopt(argc, argv, "AaF:fh:t:v")) != -1)
 		switch (ch) {
@@ -127,6 +124,10 @@ main(int argc, char *argv[])
 	argc -= optind;
 	argv += optind;
 
+	/* Start disks transferring immediately. */
+	if ((fflag & MNT_FORCE) == 0)
+		sync();
+
 	if ((argc == 0 && !all) || (argc != 0 && all))
 		usage();
 
_______________________________________________
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-unsubscribe@freebsd.org"
Comment 4 Rick Macklem freebsd_committer freebsd_triage 2011-05-29 22:23:22 UTC
State Changed
From-To: open->feedback


The commits r222464, r222466 should fix the old/regular NFS 
client w.r.t. doinf forced dismounts against a dead server. 
They will be MFC'd to stable/8 in 2 weeks.
Comment 5 Rick Macklem freebsd_committer freebsd_triage 2011-06-17 19:27:01 UTC
State Changed
From-To: feedback->closed


The changes that allow a "umount -f" to work on an 
NFS mount point against an unresponsive NFS server are 
now in stable/8.