mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
metadata: Fix metadata repair when devs still missing.
_check_reappeared_pv() incorrectly clears the MISSING_PV flags of PVs with unknown devices. While one caller avoids passing such PVs into the function, the other doesn't. Move the check inside the function so it's not forgotten. Without this patch, if the normal VG reading code tries to repair inconsistent metadata while there is an unknown PV, it incorrectly considers the missing PVs no longer to be missing and produces incorrect 'pvs' output omitting the missing PV, for example. Easy reproducer: Create a VG with 3 PVs pv1, pv2, pv3. Hide pv2. Run vgreduce --removemissing. Reinstate the hidden PV pv2 and at the same time hide a different PV pv3. Run 'pvs' - incorrect output. Run 'pvs' again - correct output. See https://bugzilla.redhat.com/1434054
This commit is contained in:
parent
d45531712d
commit
80900dcf76
@ -1,5 +1,6 @@
|
|||||||
Version 2.02.172 -
|
Version 2.02.172 -
|
||||||
===============================
|
===============================
|
||||||
|
Don't reinstate still-missing devices when correcting inconsistent metadata.
|
||||||
Properly handle subshell return codes in fsadm.
|
Properly handle subshell return codes in fsadm.
|
||||||
Disallow cachepool creation with policy cleaner and mode writeback.
|
Disallow cachepool creation with policy cleaner and mode writeback.
|
||||||
|
|
||||||
|
@ -3912,6 +3912,12 @@ static int _check_reappeared_pv(struct volume_group *correct_vg,
|
|||||||
if (correct_vg->cmd->handles_missing_pvs)
|
if (correct_vg->cmd->handles_missing_pvs)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Skip this if there is no underlying device present for this PV.
|
||||||
|
*/
|
||||||
|
if (!pv->dev)
|
||||||
|
return rv;
|
||||||
|
|
||||||
dm_list_iterate_items(pvl, &correct_vg->pvs)
|
dm_list_iterate_items(pvl, &correct_vg->pvs)
|
||||||
if (pv->dev == pvl->pv->dev && is_missing_pv(pvl->pv)) {
|
if (pv->dev == pvl->pv->dev && is_missing_pv(pvl->pv)) {
|
||||||
if (act)
|
if (act)
|
||||||
@ -4174,7 +4180,6 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
|
|||||||
if (lvmetad_used() && !use_precommitted) {
|
if (lvmetad_used() && !use_precommitted) {
|
||||||
if ((correct_vg = lvmcache_get_vg(cmd, vgname, vgid, precommitted))) {
|
if ((correct_vg = lvmcache_get_vg(cmd, vgname, vgid, precommitted))) {
|
||||||
dm_list_iterate_items(pvl, &correct_vg->pvs)
|
dm_list_iterate_items(pvl, &correct_vg->pvs)
|
||||||
if (pvl->pv->dev)
|
|
||||||
reappeared += _check_reappeared_pv(correct_vg, pvl->pv, *consistent);
|
reappeared += _check_reappeared_pv(correct_vg, pvl->pv, *consistent);
|
||||||
if (reappeared && *consistent)
|
if (reappeared && *consistent)
|
||||||
*consistent = _repair_inconsistent_vg(correct_vg);
|
*consistent = _repair_inconsistent_vg(correct_vg);
|
||||||
|
Loading…
Reference in New Issue
Block a user