slack: require module param before enabling slack compression

Just an extra explicit opt-in, since it changes the compression method
isn't upstreamed yet.
This commit is contained in:
Rob Norris 2024-01-15 12:58:12 +11:00
parent 014ff864d8
commit 831fdad1b0
1 changed files with 11 additions and 0 deletions

View File

@ -241,6 +241,11 @@ unsigned long zfs_max_nvlist_src_size = 0;
*/ */
unsigned long zfs_history_output_max = 1024 * 1024; unsigned long zfs_history_output_max = 1024 * 1024;
/*
* Whether or not to allow compression=slack to be set on a dataset.
*/
int zfs_slack_compress_enabled = 0;
uint_t zfs_fsyncer_key; uint_t zfs_fsyncer_key;
uint_t zfs_allow_log_key; uint_t zfs_allow_log_key;
@ -4573,6 +4578,9 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
if (compval == ZIO_COMPRESS_SLACK) { if (compval == ZIO_COMPRESS_SLACK) {
spa_t *spa; spa_t *spa;
if (!zfs_slack_compress_enabled)
return (SET_ERROR(ENOTSUP));
if ((err = spa_open(dsname, &spa, FTAG)) != 0) if ((err = spa_open(dsname, &spa, FTAG)) != 0)
return (err); return (err);
@ -7770,4 +7778,7 @@ ZFS_MODULE_PARAM(zfs, zfs_, max_nvlist_src_size, ULONG, ZMOD_RW,
ZFS_MODULE_PARAM(zfs, zfs_, history_output_max, ULONG, ZMOD_RW, ZFS_MODULE_PARAM(zfs, zfs_, history_output_max, ULONG, ZMOD_RW,
"Maximum size in bytes of ZFS ioctl output that will be logged"); "Maximum size in bytes of ZFS ioctl output that will be logged");
ZFS_MODULE_PARAM(zfs, zfs_, slack_compress_enabled, INT, ZMOD_RW,
"Allow slack compression feature to be set on a dataset");
/* END CSTYLED */ /* END CSTYLED */