Skip to content

Commit 2bf6b67

Browse files
committed
Disable rw_tryupgrade() due to deadlocking
Signed-off-by: Jorgen Lundman <lundman@lundman.net>
1 parent ed42c74 commit 2bf6b67

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

module/os/windows/spl/spl-rwlock.c

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,16 @@ rw_tryenter(krwlock_t *rwlp, krw_t rw)
149149
* to be non-blocking.
150150
* Also note that XNU's lck_rw_lock_shared_to_exclusive() is always
151151
* blocking (when waiting on readers), which means we can not use it.
152+
*
153+
* UPDATE
154+
*
155+
* So this won't work. If ANY thread asked for WRITE, all future
156+
* READERS are blocked until the WRITE is satisfied. This means
157+
* we easily deadlock from zap_tryupgrade(), which holds the dir,
158+
* try upgrade, which will block on READER now.
159+
* For now, we will always return failure, and the ZFS caller
160+
* can release locks, and reacquire with WRITER as needed.
161+
*
152162
*/
153163
int
154164
rw_tryupgrade(krwlock_t *rwlp)
@@ -162,6 +172,9 @@ rw_tryupgrade(krwlock_t *rwlp)
162172
if (rwlp->rw_readers != 1)
163173
return (0);
164174

175+
/* Give up */
176+
return (0);
177+
165178
/*
166179
* It is ON. We need to drop our READER lock, and try to
167180
* grab the WRITER as quickly as possible.

0 commit comments

Comments
 (0)