diff options
author | Bryan Cantrill <bryan@joyent.com> | 2013-09-20 08:33:22 +0000 |
---|---|---|
committer | Robert Mustacchi <rm@joyent.com> | 2013-11-06 15:56:44 -0800 |
commit | b3d32f0ceb59362ba287dcfd6de471e98bfc7fa9 (patch) | |
tree | 795e0fb431def1d43b0e478c32f9f08e59a75803 /usr/src/lib | |
parent | 5a450eee20035a2a426a48161ab3a50e2921878c (diff) | |
download | illumos-joyent-b3d32f0ceb59362ba287dcfd6de471e98bfc7fa9.tar.gz |
4161 deadlock between zfs_read() and zfs_putpage()
Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Jerry Jelinek <jerry.jelinek@joyent.com>
Reviewed by: Keith Wesolowski <keith.wesolowski@joyent.com>
Reviewed by: Ilya Usvyatsky <ilya.usvyatsky@nexenta.com>
Approved by: Dan McDonald <danmcd@nexenta.com>
Diffstat (limited to 'usr/src/lib')
-rw-r--r-- | usr/src/lib/libzpool/common/kernel.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/usr/src/lib/libzpool/common/kernel.c b/usr/src/lib/libzpool/common/kernel.c index 4dd614f7c1..bf7042b15d 100644 --- a/usr/src/lib/libzpool/common/kernel.c +++ b/usr/src/lib/libzpool/common/kernel.c @@ -21,6 +21,7 @@ /* * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2012 by Delphix. All rights reserved. + * Copyright (c) 2013, Joyent, Inc. All rights reserved. */ #include <assert.h> @@ -221,10 +222,10 @@ rw_enter(krwlock_t *rwlp, krw_t rw) ASSERT(rwlp->rw_owner != (void *)-1UL); ASSERT(rwlp->rw_owner != curthread); - if (rw == RW_READER) - VERIFY(rw_rdlock(&rwlp->rw_lock) == 0); - else + if (rw == RW_WRITER) VERIFY(rw_wrlock(&rwlp->rw_lock) == 0); + else + VERIFY(rw_rdlock(&rwlp->rw_lock) == 0); rwlp->rw_owner = curthread; } @@ -247,10 +248,10 @@ rw_tryenter(krwlock_t *rwlp, krw_t rw) ASSERT(rwlp->initialized == B_TRUE); ASSERT(rwlp->rw_owner != (void *)-1UL); - if (rw == RW_READER) - rv = rw_tryrdlock(&rwlp->rw_lock); - else + if (rw == RW_WRITER) rv = rw_trywrlock(&rwlp->rw_lock); + else + rv = rw_tryrdlock(&rwlp->rw_lock); if (rv == 0) { rwlp->rw_owner = curthread; |