From owner-svn-src-all@FreeBSD.ORG Tue Jan 31 03:58:27 2012 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 5682B106564A; Tue, 31 Jan 2012 03:58:27 +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 25F248FC08; Tue, 31 Jan 2012 03:58:27 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q0V3wRj2017272; Tue, 31 Jan 2012 03:58:27 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q0V3wQDt017269; Tue, 31 Jan 2012 03:58:26 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201201310358.q0V3wQDt017269@svn.freebsd.org> From: Rick Macklem Date: Tue, 31 Jan 2012 03:58:26 +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: r230803 - in head/sys: fs/nfsclient 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: Tue, 31 Jan 2012 03:58:27 -0000 Author: rmacklem Date: Tue Jan 31 03:58:26 2012 New Revision: 230803 URL: http://svn.freebsd.org/changeset/base/230803 Log: 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. Suggested by: freebsd at jdc.parodius.com (Jeremy Chadwick) MFC after: 2 weeks Modified: head/sys/fs/nfsclient/nfs_clvfsops.c head/sys/nfsclient/nfs_vfsops.c Modified: head/sys/fs/nfsclient/nfs_clvfsops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvfsops.c Tue Jan 31 02:30:47 2012 (r230802) +++ head/sys/fs/nfsclient/nfs_clvfsops.c Tue Jan 31 03:58:26 2012 (r230803) @@ -999,6 +999,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: head/sys/nfsclient/nfs_vfsops.c ============================================================================== --- head/sys/nfsclient/nfs_vfsops.c Tue Jan 31 02:30:47 2012 (r230802) +++ head/sys/nfsclient/nfs_vfsops.c Tue Jan 31 03:58:26 2012 (r230803) @@ -56,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -1116,6 +1117,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