diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-30 12:02:29 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-30 12:02:34 +0100 |
commit | ccfc09f79b8d7ba15798a2b6f76545bb7fa3681e (patch) | |
tree | a4b6dee5895c794b78a56010dce4ef188e04f67e | |
parent | 9a3b64e81ad1988f4143b5a4b4ac06eaf3035e58 (diff) | |
download | lvm2-ccfc09f79b8d7ba15798a2b6f76545bb7fa3681e.tar.gz |
metadata: format_text: also count with calculated mda size of 0
When checking minimum mda size, make sure the mda_size after alignment
and calculation is more than 0 - if there's no place for an MDA at the
end of the disk, the _text_pv_add_metadata_area does not try to add it
there and it returns (because we already have the MDA at the start of
the disk at least).
-rw-r--r-- | lib/format_text/format-text.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 29e9bd2a7..d4f2c89fb 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -2241,13 +2241,13 @@ static int _text_pv_add_metadata_area(const struct format_type *fmt, FMTu64 ").", pv_dev_name(pv), mda_size, limit_name, limit); - if (mda_size < MDA_SIZE_MIN) { - log_error("Metadata area size too small. " - "It must be at least %u bytes.", MDA_SIZE_MIN); - goto bad; - } - if (mda_size) { + if (mda_size < MDA_SIZE_MIN) { + log_error("Metadata area size too small: %" PRIu64" bytes. " + "It must be at least %u bytes.", mda_size, MDA_SIZE_MIN); + goto bad; + } + /* Wipe metadata area with zeroes. */ if (!dev_set((struct device *) pv->dev, mda_start, (size_t) ((mda_size > wipe_size) ? |