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 zpool on zvol deadlock #1220

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
12 changes: 6 additions & 6 deletions module/zfs/zvol.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,23 +921,20 @@ zvol_first_open(zvol_state_t *zv)
/* lie and say we're read-only */
error = dmu_objset_own(zv->zv_name, DMU_OST_ZVOL, 1, zvol_tag, &os);

if (locked)
mutex_exit(&spa_namespace_lock);

if (error)
return (-error);
goto out_mutex;

error = zap_lookup(os, ZVOL_ZAP_OBJ, "size", 8, 1, &volsize);
if (error) {
dmu_objset_disown(os, zvol_tag);
return (-error);
goto out_mutex;
}

zv->zv_objset = os;
error = dmu_bonus_hold(os, ZVOL_OBJ, zvol_tag, &zv->zv_dbuf);
if (error) {
dmu_objset_disown(os, zvol_tag);
return (-error);
goto out_mutex;
}

set_capacity(zv->zv_disk, volsize >> 9);
Expand All @@ -952,6 +949,9 @@ zvol_first_open(zvol_state_t *zv)
set_disk_ro(zv->zv_disk, 0);
zv->zv_flags &= ~ZVOL_RDONLY;
}
out_mutex:
if (locked)
mutex_exit(&spa_namespace_lock);

return (-error);
}
Expand Down