1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00

Fix segfault for vgcfgrestore on VG with missing PVs.

This commit is contained in:
Milan Broz 2009-03-24 13:16:34 +00:00
parent c35df82da9
commit 0ef8308f1b
3 changed files with 13 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.46 - Version 2.02.46 -
================================ ================================
Fix segfault for vgcfgrestore on VG with missing PVs.
Block SIGTERM & SIGINT in clvmd subthreads. Block SIGTERM & SIGINT in clvmd subthreads.
Detect and conditionally wipe swapspace signatures in pvcreate. Detect and conditionally wipe swapspace signatures in pvcreate.
Fix maximal volume count check for snapshots if max_lv set for volume group. Fix maximal volume count check for snapshots if max_lv set for volume group.

View File

@ -333,6 +333,12 @@ int backup_restore_from_file(struct cmd_context *cmd, const char *vg_name,
if (!(vg = backup_read_vg(cmd, vg_name, file))) if (!(vg = backup_read_vg(cmd, vg_name, file)))
return_0; return_0;
/*
* If PV is missing, there is already message from read above
*/
if (vg_missing_pv_count(vg))
return_0;
return backup_restore_vg(cmd, vg); return backup_restore_vg(cmd, vg);
} }

View File

@ -14,6 +14,8 @@
. ./test-utils.sh . ./test-utils.sh
TEST_UUID="aaaaaa-aaaa-aaaa-aaaa-aaaa-aaaa-aaaaaa"
get_lvs_() get_lvs_()
{ {
case $(lvs --units s --nosuffix --noheadings -o $1_read_ahead "$vg"/"$lv") in case $(lvs --units s --nosuffix --noheadings -o $1_read_ahead "$vg"/"$lv") in
@ -28,7 +30,7 @@ pvcreate $dev1
pvcreate --metadatacopies 0 $dev2 pvcreate --metadatacopies 0 $dev2
pvcreate --metadatacopies 0 $dev3 pvcreate --metadatacopies 0 $dev3
pvcreate $dev4 pvcreate $dev4
pvcreate --metadatacopies 0 $dev5 pvcreate -u $TEST_UUID --metadatacopies 0 $dev5
vgcreate -c n $vg $devs vgcreate -c n $vg $devs
lvcreate -n $lv -l 5 -i5 -I256 $vg lvcreate -n $lv -l 5 -i5 -I256 $vg
@ -67,6 +69,9 @@ lvrename "$vg" "$lv" "$lv-rename"
vgcfgbackup -f "$(pwd)/backup.$$" "$vg" vgcfgbackup -f "$(pwd)/backup.$$" "$vg"
vgchange -an "$vg" vgchange -an "$vg"
vgcfgrestore -f "$(pwd)/backup.$$" "$vg" vgcfgrestore -f "$(pwd)/backup.$$" "$vg"
pvremove -y -ff $dev5
not vgcfgrestore -f "$(pwd)/backup.$$" "$vg"
pvcreate -u $TEST_UUID --restorefile "$(pwd)/backup.$$" $dev5
vgremove -f "$vg" vgremove -f "$vg"
pvresize --setphysicalvolumesize 10M "$dev1" pvresize --setphysicalvolumesize 10M "$dev1"