mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2025-01-27 18:34:22 +03:00
Fix import wrong spare/l2 device when path change
If, for example, your aux device was /dev/sdc, but now the aux device is removed and /dev/sdc points to other device. zpool import will still use that device and corrupt it. The problem is that the spa_validate_aux in spa_import, rather than validate the on-disk label, it would actually write label to disk. We remove them since spa_load_{spares,l2cache} seems to do everything we need and they would actually validate on-disk label. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Chunwei Chen <david.chen@osnexus.com> Closes #6158
This commit is contained in:
parent
2e9c8dbddf
commit
b870c4b5d7
@ -4114,12 +4114,6 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags)
|
|||||||
|
|
||||||
VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
|
VERIFY(nvlist_lookup_nvlist(config, ZPOOL_CONFIG_VDEV_TREE,
|
||||||
&nvroot) == 0);
|
&nvroot) == 0);
|
||||||
if (error == 0)
|
|
||||||
error = spa_validate_aux(spa, nvroot, -1ULL,
|
|
||||||
VDEV_ALLOC_SPARE);
|
|
||||||
if (error == 0)
|
|
||||||
error = spa_validate_aux(spa, nvroot, -1ULL,
|
|
||||||
VDEV_ALLOC_L2CACHE);
|
|
||||||
spa_config_exit(spa, SCL_ALL, FTAG);
|
spa_config_exit(spa, SCL_ALL, FTAG);
|
||||||
|
|
||||||
if (props != NULL)
|
if (props != NULL)
|
||||||
|
Loading…
Reference in New Issue
Block a user