]> granicus.if.org Git - zfs/commitdiff
Add zvol_open() error handling for readonly property
authorBrian Behlendorf <behlendorf1@llnl.gov>
Sat, 20 Dec 2014 00:28:48 +0000 (16:28 -0800)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 30 Jan 2015 22:44:06 +0000 (14:44 -0800)
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 <behlendorf1@llnl.gov>
Closes #1343

module/zfs/zvol.c

index 6a84c8ad96c083ec85bbe2240e961227b4a99094..8c43e198aca782b67a85d3738d9836e09ef61d9b 100644 (file)
@@ -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);