diff options
author | Milan Broz <mbroz@redhat.com> | 2009-03-03 16:35:32 +0000 |
---|---|---|
committer | Milan Broz <mbroz@redhat.com> | 2009-03-03 16:35:32 +0000 |
commit | a920074468446eed29a17a28671398cddfe40a87 (patch) | |
tree | c8d4488f639791576cec8ed13c06ac662ea94787 | |
parent | 5ab342e2989fc881e8d413f780492f4960bda5eb (diff) | |
download | lvm2-2_02_45.tar.gz |
vgname_from_mda now tries to parse for vgname evenv2_02_45old-v2_02_45
if rlocn not defined (there is no metadata area).
In most cases it fails in validate_name(),
unfortunately there are situatuions, when
validate_name is ok and later code fails with
checksum error.
Reproducer:
# dd if=/dev/zero of=/dev/loop0
# pvcreate --metadatasize 637k /dev/loop0
Physical volume "/dev/loop0" successfully created
# pvs /dev/loop0
/dev/loop0: Checksum error
PV VG Fmt Attr PSize PFree
/dev/loop0 lvm2 -- 1.00M 1.00M
Signed-off-by: Milan Broz <mbroz@redhat.com>
-
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/format_text/format-text.c | 6 |
2 files changed, 7 insertions, 0 deletions
@@ -1,5 +1,6 @@ Version 2.02.45 - 3rd March 2009 ================================ + Avoid scanning empty metadata areas for VG names. Attempt proper clean up in child before executing new binary in exec_cmd(). Do not scan devices if reporting only attributes from PV label. Use pkgconfig to obtain corosync library details during configuration. diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 768446fb6..b70a97f61 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -1061,6 +1061,12 @@ const char *vgname_from_mda(const struct format_type *fmt, /* FIXME Cope with returning a list */ rlocn = mdah->raw_locns; + /* + * If no valid offset, do not try to search for vgname + */ + if (!rlocn->offset) + goto out; + /* Do quick check for a vgname */ if (!dev_read(dev_area->dev, dev_area->start + rlocn->offset, NAME_LEN, buf)) |