Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ZAP upgrade deadlock #4692

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions module/zfs/zap.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,20 @@ zap_tryupgradedir(zap_t *zap, dmu_tx_t *tx)
{
if (RW_WRITE_HELD(&zap->zap_rwlock))
return (1);

#ifndef __linux__
/*
* Unsafe under Linux because the rw_tryupgrade() implementation must
* release the lock before attempting to upgrade. This can result in
* a lock inversion with the l_rwlock unless the leaf lock is dropped
* first and reaquired. Rather than restruct this code disable this
* minor optimization under Linux.
*/
if (rw_tryupgrade(&zap->zap_rwlock)) {
dmu_buf_will_dirty(zap->zap_dbuf, tx);
return (1);
}
#endif
return (0);
}

Expand Down