mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-18 10:04:20 +03:00
metadata: fix segfault when filters reject devices
Checking for devices uses is_missing_pv() to check if there is a device for the PV. is_missing_pv() is based on the MISSING_PV flag, which does not always correspond to !pv->dev. When using lvmetad, a command like: pvs --config 'devices/filter=["a|/dev/sdb|", "r|.*|"]' will cause a number of PVs to have NULL pv->dev, but not the MISSING_PV flag. So, NULL pv->dev needs to also be checked.
This commit is contained in:
parent
49f32e4859
commit
3c53acb378
@ -4682,6 +4682,15 @@ static int _check_devs_used_correspond_with_vg(struct volume_group *vg)
|
||||
|
||||
/* Mark all PVs in VG as used. */
|
||||
dm_list_iterate_items(pvl, &vg->pvs) {
|
||||
/*
|
||||
* FIXME: It's not clear if the meaning
|
||||
* of "missing" should always include the
|
||||
* !pv->dev case, or if "missing" is the
|
||||
* more narrow case where VG metadata has
|
||||
* been written with the MISSING flag.
|
||||
*/
|
||||
if (!pvl->pv->dev)
|
||||
continue;
|
||||
if (is_missing_pv(pvl->pv))
|
||||
continue;
|
||||
pvl->pv->dev->flags |= DEV_ASSUMED_FOR_LV;
|
||||
|
Loading…
x
Reference in New Issue
Block a user