From ca5fd24984624146ebd1460d7554f42b0572e45f Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Fri, 11 Nov 2011 14:50:15 -0800 Subject: [PATCH] Limit maximum ashift value to 12 While we initially allowed you to set your ashift as large as 17 (SPA_MAXBLOCKSIZE) that is actually unsafe. What wasn't considered at the time is that each uberblock written to the vdev label ring buffer will be of this size. Now the buffer is statically sized to 128k and we need to be able to fit several uberblocks in it. With a large ashift that becomes a problem. Therefore I'm reducing the maximum configurable ashift value to 12. This is large enough for the 4k sector drives and small enough that we can still keep the most recent 32 uberblock in the vdev label ring buffer. Signed-off-by: Brian Behlendorf Closes #425 --- lib/libzfs/libzfs_pool.c | 2 +- module/zcommon/zpool_prop.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index d95092d..9213101 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -443,7 +443,7 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char *poolname, goto error; } - if (intval != 0 && (intval < 9 || intval > 17)) { + if (intval != 0 && (intval < 9 || intval > 12)) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "property '%s' number %d is invalid."), propname, intval); diff --git a/module/zcommon/zpool_prop.c b/module/zcommon/zpool_prop.c index 30a64d5..310598a 100644 --- a/module/zcommon/zpool_prop.c +++ b/module/zcommon/zpool_prop.c @@ -89,7 +89,7 @@ zpool_prop_init(void) /* readonly onetime number properties */ zprop_register_number(ZPOOL_PROP_ASHIFT, "ashift", 0, PROP_ONETIME, - ZFS_TYPE_POOL, "", "ASHIFT"); + ZFS_TYPE_POOL, "", "ASHIFT"); /* default number properties */ zprop_register_number(ZPOOL_PROP_VERSION, "version", SPA_VERSION, -- 1.8.3.1