mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Check large block feature flag on volumes
Since ZoL allows large blocks to be used by volumes, unlike upstream illumos, the feature flag must be checked prior to volume creation. This is critical because unlike filesystems, volumes will create a object which uses large blocks as part of the create. Therefore, it cannot be safely checked in zfs_check_settable() after the dataset can been created. In addition this patch updates the relevant error messages to use zfs_nicenum() to print the maximum blocksize. Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3591
This commit is contained in:
@@ -3201,7 +3201,7 @@ zfs_ioc_create(const char *fsname, nvlist_t *innvl, nvlist_t *outnvl)
|
||||
volblocksize = zfs_prop_default_numeric(
|
||||
ZFS_PROP_VOLBLOCKSIZE);
|
||||
|
||||
if ((error = zvol_check_volblocksize(
|
||||
if ((error = zvol_check_volblocksize(fsname,
|
||||
volblocksize)) != 0 ||
|
||||
(error = zvol_check_volsize(volsize,
|
||||
volblocksize)) != 0)
|
||||
@@ -3841,6 +3841,7 @@ zfs_check_settable(const char *dsname, nvpair_t *pair, cred_t *cr)
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
break;
|
||||
|
||||
case ZFS_PROP_VOLBLOCKSIZE:
|
||||
case ZFS_PROP_RECORDSIZE:
|
||||
/* Record sizes above 128k need the feature to be enabled */
|
||||
if (nvpair_value_uint64(pair, &intval) == 0 &&
|
||||
|
||||
+25
-1
@@ -40,6 +40,7 @@
|
||||
#include <sys/dsl_dataset.h>
|
||||
#include <sys/dsl_prop.h>
|
||||
#include <sys/zap.h>
|
||||
#include <sys/zfeature.h>
|
||||
#include <sys/zil_impl.h>
|
||||
#include <sys/zio.h>
|
||||
#include <sys/zfs_rlock.h>
|
||||
@@ -380,8 +381,31 @@ out:
|
||||
* Sanity check volume block size.
|
||||
*/
|
||||
int
|
||||
zvol_check_volblocksize(uint64_t volblocksize)
|
||||
zvol_check_volblocksize(const char *name, uint64_t volblocksize)
|
||||
{
|
||||
/* Record sizes above 128k need the feature to be enabled */
|
||||
if (volblocksize > SPA_OLD_MAXBLOCKSIZE) {
|
||||
spa_t *spa;
|
||||
int error;
|
||||
|
||||
if ((error = spa_open(name, &spa, FTAG)) != 0)
|
||||
return (error);
|
||||
|
||||
if (!spa_feature_is_enabled(spa, SPA_FEATURE_LARGE_BLOCKS)) {
|
||||
spa_close(spa, FTAG);
|
||||
return (SET_ERROR(ENOTSUP));
|
||||
}
|
||||
|
||||
/*
|
||||
* We don't allow setting the property above 1MB,
|
||||
* unless the tunable has been changed.
|
||||
*/
|
||||
if (volblocksize > zfs_max_recordsize)
|
||||
return (SET_ERROR(EDOM));
|
||||
|
||||
spa_close(spa, FTAG);
|
||||
}
|
||||
|
||||
if (volblocksize < SPA_MINBLOCKSIZE ||
|
||||
volblocksize > SPA_MAXBLOCKSIZE ||
|
||||
!ISP2(volblocksize))
|
||||
|
||||
Reference in New Issue
Block a user