aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2014-12-19 16:28:48 -0800
committerBrian Behlendorf <[email protected]>2015-01-30 14:44:06 -0800
commita127e841dee20340b300e98b6d4b62f9ad41a47b (patch)
treed4711796e58c2aa7861b1e7df2926b51ab2594de
parentf9f431cd28ed6a78a2659758ce4a83c4c76fc3a1 (diff)
Add zvol_open() error handling for readonly property
Rather than ASSERT when for some reason the readonly property of a zvol can't be read cleanly handle the failure. Signed-off-by: Brian Behlendorf <[email protected]> Closes #1343
-rw-r--r--module/zfs/zvol.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c
index 6a84c8ad9..8c43e198a 100644
--- a/module/zfs/zvol.c
+++ b/module/zfs/zvol.c
@@ -932,6 +932,10 @@ zvol_first_open(zvol_state_t *zv)
return (-SET_ERROR(ERESTARTSYS));
}
+ error = dsl_prop_get_integer(zv->zv_name, "readonly", &ro, NULL);
+ if (error)
+ goto out_mutex;
+
/* lie and say we're read-only */
error = dmu_objset_own(zv->zv_name, DMU_OST_ZVOL, 1, zvol_tag, &os);
if (error)
@@ -954,7 +958,6 @@ zvol_first_open(zvol_state_t *zv)
zv->zv_volsize = volsize;
zv->zv_zilog = zil_open(os, zvol_get_data);
- VERIFY(dsl_prop_get_integer(zv->zv_name, "readonly", &ro, NULL) == 0);
if (ro || dmu_objset_is_snapshot(os) ||
!spa_writeable(dmu_objset_spa(os))) {
set_disk_ro(zv->zv_disk, 1);