diff options
author | Don Brady <[email protected]> | 2023-05-12 10:12:28 -0600 |
---|---|---|
committer | GitHub <[email protected]> | 2023-05-12 09:12:28 -0700 |
commit | da211a4a337cce2917fa597d6930cff75f6cca2e (patch) | |
tree | c74d365b309d77b240a9107ef0aa85a02fc66a7c /lib/libzfs/libzfs_dataset.c | |
parent | 5b3b6e95c0f3aeea55932d91f469e8edd3c9cd0f (diff) |
Refine special_small_blocks property validation
When the special_small_blocks property is being set during a pool
create it enforces a limit of 128KiB even if the pool's record size
is larger.
If the recordsize property is being set during a pool create, then
use that value instead of the default SPA_OLD_MAXBLOCKSIZE value.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Don Brady <[email protected]>
Closes #13815
Closes #14811
Diffstat (limited to 'lib/libzfs/libzfs_dataset.c')
-rw-r--r-- | lib/libzfs/libzfs_dataset.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/libzfs/libzfs_dataset.c b/lib/libzfs/libzfs_dataset.c index 138eca19a..fe9f3268d 100644 --- a/lib/libzfs/libzfs_dataset.c +++ b/lib/libzfs/libzfs_dataset.c @@ -1034,6 +1034,7 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, nvlist_t *ret; int chosen_normal = -1; int chosen_utf = -1; + int set_maxbs = 0; if (nvlist_alloc(&ret, NV_UNIQUE_NAME, 0) != 0) { (void) no_memory(hdl); @@ -1252,12 +1253,17 @@ zfs_valid_proplist(libzfs_handle_t *hdl, zfs_type_t type, nvlist_t *nvl, (void) zfs_error(hdl, EZFS_BADPROP, errbuf); goto error; } + /* save the ZFS_PROP_RECORDSIZE during create op */ + if (zpool_hdl == NULL && prop == ZFS_PROP_RECORDSIZE) { + set_maxbs = intval; + } break; } case ZFS_PROP_SPECIAL_SMALL_BLOCKS: { - int maxbs = SPA_OLD_MAXBLOCKSIZE; + int maxbs = + set_maxbs == 0 ? SPA_OLD_MAXBLOCKSIZE : set_maxbs; char buf[64]; if (zpool_hdl != NULL) { |