mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
devices file: fix pvcreate --uuid matching pvid entry with no device id
pvcreate with --uuid would segfault if a devices file entry matched the specified pvid, but the devices file entry had no device_id, which could happen if the entry has a devname idtype.
This commit is contained in:
parent
1a981e9b6e
commit
8c3cfc75c7
@ -1168,8 +1168,9 @@ id_done:
|
|||||||
du_devname->devname);
|
du_devname->devname);
|
||||||
|
|
||||||
if (du_pvid && (du_pvid->dev != dev))
|
if (du_pvid && (du_pvid->dev != dev))
|
||||||
log_warn("WARNING: adding device %s with PVID %s which is already used for %s.",
|
log_warn("WARNING: adding device %s with PVID %s which is already used for %s device_id %s.",
|
||||||
dev_name(dev), pvid, du_pvid->dev ? dev_name(du_pvid->dev) : "missing device");
|
dev_name(dev), pvid, du_pvid->dev ? dev_name(du_pvid->dev) : "missing device",
|
||||||
|
du_pvid->idname ?: "none");
|
||||||
|
|
||||||
if (du_devid && (du_devid->dev != dev)) {
|
if (du_devid && (du_devid->dev != dev)) {
|
||||||
if (!du_devid->dev) {
|
if (!du_devid->dev) {
|
||||||
@ -1215,7 +1216,7 @@ id_done:
|
|||||||
else
|
else
|
||||||
check_idname = device_id_system_read(cmd, dev, du_pvid->idtype);
|
check_idname = device_id_system_read(cmd, dev, du_pvid->idtype);
|
||||||
|
|
||||||
if (check_idname && !strcmp(check_idname, du_pvid->idname)) {
|
if (!du_pvid->idname || (check_idname && !strcmp(check_idname, du_pvid->idname))) {
|
||||||
update_du = du_pvid;
|
update_du = du_pvid;
|
||||||
dm_list_del(&update_du->list);
|
dm_list_del(&update_du->list);
|
||||||
update_matching_kind = "PVID";
|
update_matching_kind = "PVID";
|
||||||
|
@ -550,6 +550,19 @@ vgchange -an $vg2
|
|||||||
vgremove -ff $vg1
|
vgremove -ff $vg1
|
||||||
vgremove -ff $vg2
|
vgremove -ff $vg2
|
||||||
|
|
||||||
|
# bz 2119473
|
||||||
|
|
||||||
|
aux lvmconf "devices/search_for_devnames = \"none\""
|
||||||
|
sed -e "s|DEVNAME=$dev1|DEVNAME=.|" "$ORIG" > tmp1.devices
|
||||||
|
sed -e "s|IDNAME=$dev1|IDNAME=.|" tmp1.devices > "$DF"
|
||||||
|
pvs
|
||||||
|
lvmdevices
|
||||||
|
pvcreate -ff --yes --uuid "$PVID1" --norestorefile $dev1
|
||||||
|
grep "$PVID1" "$DF" |tee out
|
||||||
|
grep "DEVNAME=$dev1" out
|
||||||
|
grep "IDNAME=$dev1" out
|
||||||
|
aux lvmconf "devices/search_for_devnames = \"auto\""
|
||||||
|
|
||||||
# devnames change so the new devname now refers to a filtered device,
|
# devnames change so the new devname now refers to a filtered device,
|
||||||
# e.g. an mpath or md component, which is not scanned
|
# e.g. an mpath or md component, which is not scanned
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user