From 122e5b44e1fac136df6929a2929fd2723d291120 Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 2 Jul 2010 09:24:18 -0700 Subject: [PATCH] Add missing mutex_exit(&zvol_state_lock) With the recent ZVOL update zvol_set_volblocksize() accidentally lost its mutex_exit(). This was noticed when zvol_create_minor() blocked on the zvol_state_lock while it was holding the spa_namespace_lock(). This caused everything to get blocked up and hung the system. --- module/zfs/zvol.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index ffbb29251c..955b75517a 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -342,11 +342,15 @@ zvol_set_volblocksize(const char *name, uint64_t volblocksize) mutex_enter(&zvol_state_lock); zv = zvol_find_by_name(name); - if (zv == NULL) - return (ENXIO); + if (zv == NULL) { + error = ENXIO; + goto out; + } - if (get_disk_ro(zv->zv_disk) || (zv->zv_flags & ZVOL_RDONLY)) - return (EROFS); + if (get_disk_ro(zv->zv_disk) || (zv->zv_flags & ZVOL_RDONLY)) { + error = EROFS; + goto out; + } tx = dmu_tx_create(zv->zv_objset); dmu_tx_hold_bonus(tx, ZVOL_OBJ); @@ -362,6 +366,8 @@ zvol_set_volblocksize(const char *name, uint64_t volblocksize) if (error == 0) zv->zv_volblocksize = volblocksize; } +out: + mutex_exit(&zvol_state_lock); return (error); }