diff options
Diffstat (limited to 'usr/src/uts/common/fs/zfs/zfs_ioctl.c')
-rw-r--r-- | usr/src/uts/common/fs/zfs/zfs_ioctl.c | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/usr/src/uts/common/fs/zfs/zfs_ioctl.c b/usr/src/uts/common/fs/zfs/zfs_ioctl.c index f559dba7e0..8915ae53f0 100644 --- a/usr/src/uts/common/fs/zfs/zfs_ioctl.c +++ b/usr/src/uts/common/fs/zfs/zfs_ioctl.c @@ -984,8 +984,8 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) { spa_t *spa; int error; - nvlist_t *config, **l2cache; - uint_t nl2cache; + nvlist_t *config, **l2cache, **spares; + uint_t nl2cache = 0, nspares = 0; error = spa_open(zc->zc_name, &spa, FTAG); if (error != 0) @@ -996,13 +996,20 @@ zfs_ioc_vdev_add(zfs_cmd_t *zc) (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_L2CACHE, &l2cache, &nl2cache); + (void) nvlist_lookup_nvlist_array(config, ZPOOL_CONFIG_SPARES, + &spares, &nspares); + /* * A root pool with concatenated devices is not supported. - * Thus, can not add a device to a root pool with one device. - * Allow for l2cache devices to be added. + * Thus, can not add a device to a root pool. + * + * Intent log device can not be added to a rootpool because + * during mountroot, zil is replayed, a seperated log device + * can not be accessed during the mountroot time. + * + * l2cache and spare devices are ok to be added to a rootpool. */ - if (spa->spa_root_vdev->vdev_children == 1 && spa->spa_bootfs != 0 && - nl2cache == 0) { + if (spa->spa_bootfs != 0 && nl2cache == 0 && nspares == 0) { spa_close(spa, FTAG); return (EDOM); } @@ -1348,7 +1355,7 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) return (error); } -static int +int zfs_set_prop_nvlist(const char *name, nvlist_t *nvl) { nvpair_t *elem; @@ -1919,6 +1926,7 @@ zfs_ioc_create(zfs_cmd_t *zc) default: cbfunc = NULL; + break; } if (strchr(zc->zc_name, '@') || strchr(zc->zc_name, '%')) @@ -2040,6 +2048,7 @@ zfs_ioc_create(zfs_cmd_t *zc) error = dmu_objset_create(zc->zc_name, type, NULL, cbfunc, &zct); nvlist_free(zct.zct_zplprops); + } /* @@ -2049,7 +2058,6 @@ zfs_ioc_create(zfs_cmd_t *zc) if ((error = zfs_set_prop_nvlist(zc->zc_name, nvprops)) != 0) (void) dmu_objset_destroy(zc->zc_name); } - nvlist_free(nvprops); return (error); } @@ -2934,7 +2942,7 @@ static struct cb_ops zfs_cb_ops = { zvol_close, /* close */ zvol_strategy, /* strategy */ nodev, /* print */ - nodev, /* dump */ + zvol_dump, /* dump */ zvol_read, /* read */ zvol_write, /* write */ zfsdev_ioctl, /* ioctl */ |