diff options
author | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-29 16:33:06 +0100 |
---|---|---|
committer | Peter Rajnoha <prajnoha@redhat.com> | 2015-10-29 16:46:41 +0100 |
commit | 00348c0a630a7e5578edf48052ec695b15de752f (patch) | |
tree | 87950d1340313edde917741eb0c2fcee8cc1fc05 | |
parent | ccb8da404d00288b7d49c7a28006ec5d4687bb55 (diff) | |
download | lvm2-00348c0a630a7e5578edf48052ec695b15de752f.tar.gz |
metadata: format_text: check VG metadata do not overlap themselves
We're already checking whether old and new meta do not overlap in
ring buffer (as we need to keep both old and new meta during vg_write
up until vg_commit).
We also need to check whether the new metadata do not overlap
themselves in case we don't have old metadata yet (...because
we're in vgcreate). This could happen if we're creating a VG so
that the very first metadata written are long enough that it wraps
themselves in metadata ring buffer.
Although we limited the minimum metadata area size better with the
previous commit ccb8da404d00288b7d49c7a28006ec5d4687bb55 which
makes the initial VG metadata overlap in ring buffer to be less
probable, the risk of hitting this overlap condition is still there
if we still manage to generate big enough metadata somehow.
For example, users can provide many and/or long VG tags during vgcreate
so that the VG metadata is long enough to start to wrap in the ring
buffer again...
-rw-r--r-- | lib/format_text/format-text.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/format_text/format-text.c b/lib/format_text/format-text.c index 6c653ca00..84d09478d 100644 --- a/lib/format_text/format-text.c +++ b/lib/format_text/format-text.c @@ -654,6 +654,7 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg, if ((new_wrap && old_wrap) || (rlocn && (new_wrap || old_wrap) && (new_end > rlocn->offset)) || + (!rlocn && new_wrap && (new_end > mdac->rlocn.offset)) || (mdac->rlocn.size >= mdah->size)) { log_error("VG %s metadata too large for circular buffer", vg->name); |