mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-23 02:44:41 +03:00
Write label 2,3 uberblocks when vdev expands
When vdev_psize increases, the location of labels 2 and 3 changes because their location is relative to the end of the device. The configs for labels 2 and 3 are written during the next spa_sync() because the vdev is added to the dirty config list. However, the uberblock rings are not re-written in their new location, leaving the device vulnerable to the beginning of the device being overwritten or damaged. This patch copies the uberblock ring from label 0 to labels 2 and 3, in their new locations, at the next sync after vdev_psize increases. Also, add a test zpool_expand_004_pos.ksh to confirm the uberblocks are copied. Reviewed-by: BearBabyLiu <liu.huang@zte.com.cn> Reviewed-by: Andreas Dilger <andreas.dilger@intel.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Olaf Faaland <faaland1@llnl.gov> Closes #5108
This commit is contained in:
committed by
Brian Behlendorf
parent
e7fbeb606a
commit
9d3f7b8791
@@ -1330,6 +1330,13 @@ vdev_open(vdev_t *vd)
|
||||
max_asize = max_osize;
|
||||
}
|
||||
|
||||
/*
|
||||
* If the vdev was expanded, record this so that we can re-create the
|
||||
* uberblock rings in labels {2,3}, during the next sync.
|
||||
*/
|
||||
if ((psize > vd->vdev_psize) && (vd->vdev_psize != 0))
|
||||
vd->vdev_copy_uberblocks = B_TRUE;
|
||||
|
||||
vd->vdev_psize = psize;
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user