mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
Ignore pool ashift property during vdev attachment
Ashift can be set for a vdev only during its creation, and the top-level vdev does not change when a vdev is attached or replaced. The ashift property should not be used during attachment, as it does not allow attaching/replacing a vdev if the pool's ashift property is increased after the existing vdev was created. Instead, we should be able to attach the vdev if the attached vdev can satisfy the ashift requirement with its parent. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Alexander Motin <mav@FreeBSD.org> Signed-off-by: Ameer Hamza <ahamza@ixsystems.com> Closes #15061
This commit is contained in:
+10
-4
@@ -889,9 +889,15 @@ vdev_alloc(spa_t *spa, vdev_t **vdp, nvlist_t *nv, vdev_t *parent, uint_t id,
|
||||
&vd->vdev_not_present);
|
||||
|
||||
/*
|
||||
* Get the alignment requirement.
|
||||
* Get the alignment requirement. Ignore pool ashift for vdev
|
||||
* attach case.
|
||||
*/
|
||||
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ASHIFT, &vd->vdev_ashift);
|
||||
if (alloctype != VDEV_ALLOC_ATTACH) {
|
||||
(void) nvlist_lookup_uint64(nv, ZPOOL_CONFIG_ASHIFT,
|
||||
&vd->vdev_ashift);
|
||||
} else {
|
||||
vd->vdev_attaching = B_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Retrieve the vdev creation time.
|
||||
@@ -2144,9 +2150,9 @@ vdev_open(vdev_t *vd)
|
||||
return (SET_ERROR(EDOM));
|
||||
}
|
||||
|
||||
if (vd->vdev_top == vd) {
|
||||
if (vd->vdev_top == vd && vd->vdev_attaching == B_FALSE)
|
||||
vdev_ashift_optimize(vd);
|
||||
}
|
||||
vd->vdev_attaching = B_FALSE;
|
||||
}
|
||||
if (vd->vdev_ashift != 0 && (vd->vdev_ashift < ASHIFT_MIN ||
|
||||
vd->vdev_ashift > ASHIFT_MAX)) {
|
||||
|
||||
Reference in New Issue
Block a user