mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
OpenZFS 7885 - zpool list can report 16.0e for expandsz
Authored by: Steven Hartland <steven.hartland@multiplay.co.uk> Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: George Wilson <george.wilson@delphix.com> Approved by: Gordon Ross <gordon.w.ross@gmail.com> When a member of a RAIDZ has been replaced with a device smaller than the original, then the top level vdev can report its expand size as 16.0E. The reduced child asize causes the RAIDZ to have a vdev_asize lower than its vdev_max_asize which then results in an underflow during the calculation of the parents expand size. Fix this by updating the vdev_asize if it shrinks, which is already protected by a check against vdev_min_asize so should always be safe. Also for RAIDZ vdevs, ensure that the sum of their child vdev_min_asize is always greater than the parents vdev_min_size. Reviewed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Ported-by: George Melikov <mail@gmelikov.ru> OpenZFS-issue: https://www.illumos.org/issues/7885 OpenZFS-commit: https://github.com/openzfs/openzfs/commit/bb0dbaa Closes #5963
This commit is contained in:
parent
d456708525
commit
2e215fecbe
@ -134,7 +134,8 @@ vdev_get_min_asize(vdev_t *vd)
|
|||||||
* so each child must provide at least 1/Nth of its asize.
|
* so each child must provide at least 1/Nth of its asize.
|
||||||
*/
|
*/
|
||||||
if (pvd->vdev_ops == &vdev_raidz_ops)
|
if (pvd->vdev_ops == &vdev_raidz_ops)
|
||||||
return (pvd->vdev_min_asize / pvd->vdev_children);
|
return ((pvd->vdev_min_asize + pvd->vdev_children - 1) /
|
||||||
|
pvd->vdev_children);
|
||||||
|
|
||||||
return (pvd->vdev_min_asize);
|
return (pvd->vdev_min_asize);
|
||||||
}
|
}
|
||||||
@ -1330,7 +1331,7 @@ vdev_open(vdev_t *vd)
|
|||||||
vd->vdev_psize = psize;
|
vd->vdev_psize = psize;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make sure the allocatable size hasn't shrunk.
|
* Make sure the allocatable size hasn't shrunk too much.
|
||||||
*/
|
*/
|
||||||
if (asize < vd->vdev_min_asize) {
|
if (asize < vd->vdev_min_asize) {
|
||||||
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
|
vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
|
||||||
@ -1370,12 +1371,21 @@ vdev_open(vdev_t *vd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If all children are healthy and the asize has increased,
|
* If all children are healthy we update asize if either:
|
||||||
* then we've experienced dynamic LUN growth. If automatic
|
* The asize has increased, due to a device expansion caused by dynamic
|
||||||
* expansion is enabled then use the additional space.
|
* LUN growth or vdev replacement, and automatic expansion is enabled;
|
||||||
|
* making the additional space available.
|
||||||
|
*
|
||||||
|
* The asize has decreased, due to a device shrink usually caused by a
|
||||||
|
* vdev replace with a smaller device. This ensures that calculations
|
||||||
|
* based of max_asize and asize e.g. esize are always valid. It's safe
|
||||||
|
* to do this as we've already validated that asize is greater than
|
||||||
|
* vdev_min_asize.
|
||||||
*/
|
*/
|
||||||
if (vd->vdev_state == VDEV_STATE_HEALTHY && asize > vd->vdev_asize &&
|
if (vd->vdev_state == VDEV_STATE_HEALTHY &&
|
||||||
(vd->vdev_expanding || spa->spa_autoexpand))
|
((asize > vd->vdev_asize &&
|
||||||
|
(vd->vdev_expanding || spa->spa_autoexpand)) ||
|
||||||
|
(asize < vd->vdev_asize)))
|
||||||
vd->vdev_asize = asize;
|
vd->vdev_asize = asize;
|
||||||
|
|
||||||
vdev_set_min_asize(vd);
|
vdev_set_min_asize(vd);
|
||||||
|
Loading…
Reference in New Issue
Block a user