Author: rmacklem
Date: Tue Feb 14 05:12:52 2012
New Revision: 231637
URL: http://svn.freebsd.org/changeset/base/231637

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/8/sys/fs/nfsclient/nfs_clvfsops.c
  stable/8/sys/nfsclient/nfs_vfsops.c
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/boot/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)
  stable/8/sys/dev/e1000/   (props changed)

Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvfsops.c    Tue Feb 14 04:48:36 2012        
(r231636)
+++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c    Tue Feb 14 05:12:52 2012        
(r231637)
@@ -985,6 +985,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/8/sys/nfsclient/nfs_vfsops.c
==============================================================================
--- stable/8/sys/nfsclient/nfs_vfsops.c Tue Feb 14 04:48:36 2012        
(r231636)
+++ stable/8/sys/nfsclient/nfs_vfsops.c Tue Feb 14 05:12:52 2012        
(r231637)
@@ -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>
 
@@ -1104,6 +1105,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
_______________________________________________
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