Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 28 Feb 2012 15:52:02 +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: r232259 - in stable/9/sys: fs/nfsserver i386/conf
Message-ID:  <201202281552.q1SFq2AI077486@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Tue Feb 28 15:52:01 2012
New Revision: 232259
URL: http://svn.freebsd.org/changeset/base/232259

Log:
  MFC: r232050
  hrs@ reported a panic to freebsd-stable@ under the subject line
  "panic in 8.3-PRERELEASE" on Feb. 22, 2012. This panic was caused
  by use of a mix of tsleep() and msleep() calls on the same event
  in the new NFS server DRC code. It did "mtx_unlock(); tsleep();"
  in two places, which kib@ noted introduced a slight risk that the
  wakeup() would occur before the tsleep(), resulting in a 10sec
  delay before waking up. This patch fixes the problem by replacing
  "mtx_unlock(); tsleep();" with mtx_sleep(..PDROP..). It also
  changes a nfsmsleep() call to mtx_sleep() so that the code uses
  mtx_sleep() consistently within the file.

Modified:
  stable/9/sys/fs/nfsserver/nfs_nfsdcache.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)
  stable/9/sys/i386/conf/XENHVM   (props changed)

Modified: stable/9/sys/fs/nfsserver/nfs_nfsdcache.c
==============================================================================
--- stable/9/sys/fs/nfsserver/nfs_nfsdcache.c	Tue Feb 28 15:47:39 2012	(r232258)
+++ stable/9/sys/fs/nfsserver/nfs_nfsdcache.c	Tue Feb 28 15:52:01 2012	(r232259)
@@ -336,9 +336,8 @@ loop:
 		nfsaddr_match(NETFAMILY(rp), &rp->rc_haddr, nd->nd_nam)) {
 			if ((rp->rc_flag & RC_LOCKED) != 0) {
 				rp->rc_flag |= RC_WANTED;
-				NFSUNLOCKCACHE();
-				(void) tsleep((caddr_t)rp, PZERO - 1,
-				    "nfsrc", 10 * hz);
+				(void)mtx_sleep(rp, NFSCACHEMUTEXPTR,
+				    (PZERO - 1) | PDROP, "nfsrc", 10 * hz);
 				goto loop;
 			}
 			if (rp->rc_flag == 0)
@@ -622,8 +621,8 @@ tryagain:
 		rp = hitrp;
 		if ((rp->rc_flag & RC_LOCKED) != 0) {
 			rp->rc_flag |= RC_WANTED;
-			NFSUNLOCKCACHE();
-			(void) tsleep((caddr_t)rp, PZERO-1, "nfsrc", 10 * hz);
+			(void)mtx_sleep(rp, NFSCACHEMUTEXPTR,
+			    (PZERO - 1) | PDROP, "nfsrc", 10 * hz);
 			goto tryagain;
 		}
 		if (rp->rc_flag == 0)
@@ -694,7 +693,7 @@ nfsrc_lock(struct nfsrvcache *rp)
 	NFSCACHELOCKREQUIRED();
 	while ((rp->rc_flag & RC_LOCKED) != 0) {
 		rp->rc_flag |= RC_WANTED;
-		(void) nfsmsleep((caddr_t)rp, NFSCACHEMUTEXPTR, PZERO - 1,
+		(void)mtx_sleep(rp, NFSCACHEMUTEXPTR, PZERO - 1,
 		    "nfsrc", 0);
 	}
 	rp->rc_flag |= RC_LOCKED;



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