diff options
author | Ryan Moeller <[email protected]> | 2020-10-21 17:59:15 +0000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2020-10-30 15:34:36 -0700 |
commit | 9a0ef216e53fef8c1166154efb4b259d889ec83d (patch) | |
tree | 7993cc77a04baef33c806cf164f32e621826b7fd /module | |
parent | 1a6a75ac07457f66461bb1eada71d11e68a89f8a (diff) |
zvol_os: Properly ignore error in volmode lookup
We fall back to a default volmode and continue when looking up a zvol's
volmode property fails. After this we should set the error to 0 to
ensure we take the success paths in the out section.
While here, make sure we only log that the zvol was created on success.
Reviewed-by: Alexander Motin <[email protected]>
Reviewed-by: Matt Macy <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #11117
Diffstat (limited to 'module')
-rw-r--r-- | module/os/freebsd/zfs/zvol_os.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/module/os/freebsd/zfs/zvol_os.c b/module/os/freebsd/zfs/zvol_os.c index 13e2e83ae..bae39c6d5 100644 --- a/module/os/freebsd/zfs/zvol_os.c +++ b/module/os/freebsd/zfs/zvol_os.c @@ -1279,6 +1279,8 @@ zvol_create_minor_impl(const char *name) zfs_prop_to_name(ZFS_PROP_VOLMODE), &volmode, NULL); if (error || volmode == ZFS_VOLMODE_DEFAULT) volmode = zvol_volmode; + error = 0; + /* * zvol_alloc equivalent ... */ @@ -1357,9 +1359,8 @@ zvol_create_minor_impl(const char *name) out_dmu_objset_disown: dmu_objset_disown(os, B_TRUE, FTAG); - if (zv->zv_zso->zso_volmode == ZFS_VOLMODE_GEOM) { - if (error == 0) - zvol_geom_run(zv); + if (error == 0 && volmode == ZFS_VOLMODE_GEOM) { + zvol_geom_run(zv); g_topology_unlock(); } out_doi: @@ -1369,8 +1370,8 @@ out_doi: zvol_insert(zv); zvol_minors++; rw_exit(&zvol_state_lock); + ZFS_LOG(1, "ZVOL %s created.", name); } - ZFS_LOG(1, "ZVOL %s created.", name); out_giant: PICKUP_GIANT(); return (error); |