From 727506c943f517533ad886cdf8e2cf258cfad12a Mon Sep 17 00:00:00 2001 From: Alexander Motin Date: Tue, 29 Oct 2024 15:23:24 -0400 Subject: [PATCH] On the first vdev open ignore impossible ashift hints If on the first open device's logical ashift is bigger than set by pool's ashift property, ignore the last as unusable instead of creating vdev that will fail most of I/Os due to misalignment. Reviewed-by: Rob Norris Reviewed-by: Brian Behlendorf Reviewed-by: Ameer Hamza Signed-off-by: Alexander Motin Sponsored by: iXsystems, Inc. Closes #16690 --- module/zfs/vdev.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index f8055e69c916..82763c125caa 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -2178,10 +2178,11 @@ vdev_open(vdev_t *vd) vd->vdev_max_asize = max_asize; /* - * If the vdev_ashift was not overridden at creation time, + * If the vdev_ashift was not overridden at creation time + * (0) or the override value is impossible for the device, * then set it the logical ashift and optimize the ashift. */ - if (vd->vdev_ashift == 0) { + if (vd->vdev_ashift < vd->vdev_logical_ashift) { vd->vdev_ashift = vd->vdev_logical_ashift; if (vd->vdev_logical_ashift > ASHIFT_MAX) {