Skip to content

Commit 74eaf3d

Browse files
committed
Fix checking for the feature at spa_vdev_add()
Now vdev is actually not adding if the feature is not enabled. Previously, it was showing the error, but vdev was adding to the pool. The fix is to add the check at the earliest point, just after vdev_draid_spare_create() call. Signed-off-by: Andriy Tkachuk <andriy.tkachuk@seagate.com>
1 parent 0f25b76 commit 74eaf3d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

module/zfs/spa.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7550,9 +7550,14 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot, boolean_t check_ashift)
75507550
*/
75517551
if ((error = vdev_draid_spare_create(nvroot, vd, &ndraid,
75527552
&draid_nfgroup, rvd->vdev_children)) == 0) {
7553+
75537554
if (ndraid > 0 && nvlist_lookup_nvlist_array(nvroot,
75547555
ZPOOL_CONFIG_SPARES, &spares, &nspares) != 0)
75557556
nspares = 0;
7557+
7558+
if (draid_nfgroup > 0 && !spa_feature_is_enabled(spa,
7559+
SPA_FEATURE_DRAID_FAIL_DOMAINS))
7560+
return (spa_vdev_exit(spa, vd, txg, ENOTSUP));
75567561
} else {
75577562
return (spa_vdev_exit(spa, vd, txg, error));
75587563
}
@@ -7643,10 +7648,6 @@ spa_vdev_add(spa_t *spa, nvlist_t *nvroot, boolean_t check_ashift)
76437648
dsl_sync_task_nowait(spa->spa_dsl_pool, spa_draid_feature_incr,
76447649
(void *)(uintptr_t)ndraid, tx);
76457650

7646-
if (!spa_feature_is_enabled(spa,
7647-
SPA_FEATURE_DRAID_FAIL_DOMAINS) && draid_nfgroup > 0)
7648-
return (spa_vdev_exit(spa, vd, txg, ENOTSUP));
7649-
76507651
if (draid_nfgroup > 0)
76517652
dsl_sync_task_nowait(spa->spa_dsl_pool,
76527653
spa_draid_fdomains_feature_incr,

0 commit comments

Comments
 (0)