diff options
author | rmacklem <rmacklem@FreeBSD.org> | 2012-02-23 16:47:05 +0000 |
---|---|---|
committer | rmacklem <rmacklem@FreeBSD.org> | 2012-02-23 16:47:05 +0000 |
commit | a05fe1c2c9c93b4362978465d9009af686302f2a (patch) | |
tree | cd3a1103328da6a58903561bd3380a23b32dbc6a /sys/fs/nfsserver | |
parent | bfe47eb1dfe2cde280e0f7b11cb1484279fbaebb (diff) | |
download | FreeBSD-src-a05fe1c2c9c93b4362978465d9009af686302f2a.zip FreeBSD-src-a05fe1c2c9c93b4362978465d9009af686302f2a.tar.gz |
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.
Tested by: hrs (in progress)
Reviewed by: jhb
MFC after: 5 days
Diffstat (limited to 'sys/fs/nfsserver')
-rw-r--r-- | sys/fs/nfsserver/nfs_nfsdcache.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/sys/fs/nfsserver/nfs_nfsdcache.c b/sys/fs/nfsserver/nfs_nfsdcache.c index 50f92ad..0ee3b02 100644 --- a/sys/fs/nfsserver/nfs_nfsdcache.c +++ b/sys/fs/nfsserver/nfs_nfsdcache.c @@ -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; |