Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 14 Feb 2012 04:48:37 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org
Subject:   svn commit: r231636 - in stable/9/sys: fs/nfsclient nfsclient
Message-ID:  <201202140448.q1E4mbq8078284@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Feb 14 04:48:36 2012
New Revision: 231636
URL: http://svn.freebsd.org/changeset/base/231636

Log:
  MFC: r230803
  When a "mount -u" switches an NFS mount point from TCP to UDP,
  any thread doing an I/O RPC with a transfer size greater than
  NFS_UDPMAXDATA will be hung indefinitely, retrying the RPC.
  After a discussion on freebsd-fs@, I decided to add a warning
  message for this case, as suggested by Jeremy Chadwick.

Modified:
  stable/9/sys/fs/nfsclient/nfs_clvfsops.c
  stable/9/sys/nfsclient/nfs_vfsops.c
Directory Properties:
  stable/9/sys/   (props changed)
  stable/9/sys/amd64/include/xen/   (props changed)
  stable/9/sys/boot/   (props changed)
  stable/9/sys/boot/i386/efi/   (props changed)
  stable/9/sys/boot/ia64/efi/   (props changed)
  stable/9/sys/boot/ia64/ski/   (props changed)
  stable/9/sys/boot/powerpc/boot1.chrp/   (props changed)
  stable/9/sys/boot/powerpc/ofw/   (props changed)
  stable/9/sys/cddl/contrib/opensolaris/   (props changed)
  stable/9/sys/conf/   (props changed)
  stable/9/sys/contrib/dev/acpica/   (props changed)
  stable/9/sys/contrib/octeon-sdk/   (props changed)
  stable/9/sys/contrib/pf/   (props changed)
  stable/9/sys/contrib/x86emu/   (props changed)

Modified: stable/9/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/9/sys/fs/nfsclient/nfs_clvfsops.c	Tue Feb 14 04:20:02 2012	(r231635)
+++ stable/9/sys/fs/nfsclient/nfs_clvfsops.c	Tue Feb 14 04:48:36 2012	(r231636)
@@ -989,6 +989,19 @@ nfs_mount(struct mount *mp)
 			error = EIO;
 			goto out;
 		}
+
+		/*
+		 * If a change from TCP->UDP is done and there are thread(s)
+		 * that have I/O RPC(s) in progress with a tranfer size
+		 * greater than NFS_MAXDGRAMDATA, those thread(s) will be
+		 * hung, retrying the RPC(s) forever. Usually these threads
+		 * will be seen doing an uninterruptible sleep on wait channel
+		 * "newnfsreq" (truncated to "newnfsre" by procstat).
+		 */
+		if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM)
+			tprintf(td->td_proc, LOG_WARNING,
+	"Warning: mount -u that changes TCP->UDP can result in hung threads\n");
+
 		/*
 		 * When doing an update, we can't change version,
 		 * security, switch lockd strategies or change cookie

Modified: stable/9/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/9/sys/nfsclient/nfs_vfsops.c	Tue Feb 14 04:20:02 2012	(r231635)
+++ stable/9/sys/nfsclient/nfs_vfsops.c	Tue Feb 14 04:48:36 2012	(r231636)
@@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/socketvar.h>
 #include <sys/sockio.h>
 #include <sys/sysctl.h>
+#include <sys/syslog.h>
 #include <sys/vnode.h>
 #include <sys/signalvar.h>
 
@@ -1106,6 +1107,19 @@ nfs_mount(struct mount *mp)
 			error = EIO;
 			goto out;
 		}
+
+		/*
+		 * If a change from TCP->UDP is done and there are thread(s)
+		 * that have I/O RPC(s) in progress with a tranfer size
+		 * greater than NFS_MAXDGRAMDATA, those thread(s) will be
+		 * hung, retrying the RPC(s) forever. Usually these threads
+		 * will be seen doing an uninterruptible sleep on wait channel
+		 * "newnfsreq" (truncated to "newnfsre" by procstat).
+		 */
+		if (args.sotype == SOCK_DGRAM && nmp->nm_sotype == SOCK_STREAM)
+			tprintf(curthread->td_proc, LOG_WARNING,
+	"Warning: mount -u that changes TCP->UDP can result in hung threads\n");
+
 		/*
 		 * When doing an update, we can't change from or to
 		 * v3, switch lockd strategies or change cookie translation



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