From owner-svn-src-stable@FreeBSD.ORG Tue Feb 28 15:52:02 2012 Return-Path: Delivered-To: svn-src-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 796BA106566B; Tue, 28 Feb 2012 15:52:02 +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 4DDC98FC13; Tue, 28 Feb 2012 15:52:02 +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 q1SFq2ji077489; Tue, 28 Feb 2012 15:52:02 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q1SFq2AI077486; Tue, 28 Feb 2012 15:52:02 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202281552.q1SFq2AI077486@svn.freebsd.org> From: Rick Macklem Date: Tue, 28 Feb 2012 15:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-9@freebsd.org X-SVN-Group: stable-9 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r232259 - in stable/9/sys: fs/nfsserver i386/conf X-BeenThere: svn-src-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for all the -stable branches of the src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 28 Feb 2012 15:52:02 -0000 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;