ZVOL: Return early, if volmode is ZFS_VOLMODE_NONE on FreeBSD side

Return from zvol_os_create_minor() function immediately after
dsl_prop_get_integer() call if volmode property value is set to
'none', like it is doing on Linux side.

Sponsored-by: vStack, Inc.
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Fedor Uporov <[email protected]>
Closes #17405
This commit is contained in:
Fedor Uporov authored and GitHub committed 2025-07-30 09:46:34 -07:00
1 parent ce9c3b4b94
commit dea0fc969b
1 file changed
+7 -3
+7 -3
View File
@@ -1402,9 +1402,13 @@ zvol_os_create_minor(const char *name)
error = dsl_prop_get_integer(name,
zfs_prop_to_name(ZFS_PROP_VOLMODE), &volmode, NULL);
if (error || volmode == ZFS_VOLMODE_DEFAULT)
if (error)
goto out_dmu_objset_disown;
if (volmode == ZFS_VOLMODE_DEFAULT)
volmode = zvol_volmode;
error = 0;
if (volmode == ZFS_VOLMODE_NONE)
goto out_dmu_objset_disown;
/*
* zvol_alloc equivalent ...
@@ -1496,7 +1500,7 @@ out_dmu_objset_disown:
}
out_doi:
kmem_free(doi, sizeof (dmu_object_info_t));
if (error == 0) {
if (error == 0 && volmode != ZFS_VOLMODE_NONE) {
rw_enter(&zvol_state_lock, RW_WRITER);
zvol_insert(zv);
zvol_minors++;