diff options
author | Andrew Barnes <[email protected]> | 2014-06-10 16:29:12 +1000 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2014-07-02 14:04:29 -0700 |
commit | 61e99a73bc34d602639c5a991abdc1e011a52d8d (patch) | |
tree | b402987d54ad459c0b06368dccd2d459552faa59 /module/zfs/vdev.c | |
parent | b8fce77b08d110e5f1b8d3161b888b3e6f8e750c (diff) |
Preserve asize when last mirror child promoted to top-level vdev
If the smaller of 2 different sized child vdev's of a mirrored vdev is
detached, and the pool has the autoexpand property set to off, as the
remaining larger vdev is promoted to a top level vdev it fails to retain
the asize of the original top level mirror vdev and therefore partially
autoexpands.
This partially autoexpanded state leaves the new vdev too large to
re-mirror by adding the smaller vdev back in, and the pool fails to
utilize the space until next imported.
If the autoexpand property is set to on, the child vdev grows
in size after it has been promoted to a top level vdev as expected.
This commit causes the remaining child mirror to retain the asize of its
old parent mirror vdev if the autoexpand property is set to off,
this allows the smaller vdev to be re-added if required the vdev
can then be told to expand if required by the usual using zpool online -e.
Signed-off-by: Brian Behlendorf <[email protected]>
Signed-off-by: Andrew Barnes <[email protected]>
Signed-off-by: George Wilson <[email protected]>
Closes #1208
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r-- | module/zfs/vdev.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 7751683d1..4c67792c9 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -793,6 +793,17 @@ vdev_remove_parent(vdev_t *cvd) cvd->vdev_orig_guid = cvd->vdev_guid; cvd->vdev_guid += guid_delta; cvd->vdev_guid_sum += guid_delta; + + /* + * If pool not set for autoexpand, we need to also preserve + * mvd's asize to prevent automatic expansion of cvd. + * Otherwise if we are adjusting the mirror by attaching and + * detaching children of non-uniform sizes, the mirror could + * autoexpand, unexpectedly requiring larger devices to + * re-establish the mirror. + */ + if (!cvd->vdev_spa->spa_autoexpand) + cvd->vdev_asize = mvd->vdev_asize; } cvd->vdev_id = mvd->vdev_id; vdev_add_child(pvd, cvd); |