Increase LVM implementation robustness in order not to crash on

configurations like pvmove. Previously code assumed that in some places
	only lvs or only pvs are used whereas it seems that they are used
	interchangeably.

	* grub-core/disk/lvm.c (read_node): New function.
	(read_lv): Use read_node.
	(grub_lvm_scan_device): Use only first mirror on pvmove'd lvs.
	Match volumes only at the end when all lvs are found. Take both
	pvs (first) and lvs (second) into account.
	* include/grub/lvm.h (grub_lvm_segment): Merge fields stripe_* and
	mirror_* into node_*. All users updated.
	(grub_lvm_stripe): Merge this ...
	(grub_lvm_mirror): ... and this ...
	(grub_lvm_node): ... into this. All users updated.
This commit is contained in:
Vladimir 'phcoder' Serbinenko 2011-04-03 16:28:14 +02:00
parent 6f33215394
commit 850e937329
3 changed files with 103 additions and 74 deletions

View file

@ -60,21 +60,16 @@ struct grub_lvm_segment {
unsigned int extent_count;
enum { GRUB_LVM_STRIPED, GRUB_LVM_MIRROR } type;
unsigned int mirror_count;
struct grub_lvm_mirror *mirrors;
unsigned int node_count;
struct grub_lvm_node *nodes;
unsigned int stripe_count;
unsigned int stripe_size;
struct grub_lvm_stripe *stripes; /* Pointer to stripe_count stripes. */
};
struct grub_lvm_stripe {
int start;
struct grub_lvm_node {
grub_disk_addr_t start;
char *name;
struct grub_lvm_pv *pv;
};
struct grub_lvm_mirror {
char *lvname;
struct grub_lvm_lv *lv;
};