mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
metadata: format_text: better check for metadata overlap
Actually, we don't need extra condition as introduced in commit00348c0a63
. We should fix the last condition: (mdac->rlocn.size >= mdah->size) ...which should be: (MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)) Where the "mdac" is new metadata, the "rlocn" is old metadata. So the main problem with the previous condition was that it didn't count in MDA_HEADER_SIZE properly (and possible existing metadata - the "rlocn"). This could have caused the error state where metadata in ring buffer overlap to not be hit. Replace the new condition introduced in00348c0a63
with the improved one for the condition that existed there already but it was just incomplete.
This commit is contained in:
parent
406d8ff332
commit
c2e88d1107
@ -654,8 +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)) {
|
||||
(MDA_HEADER_SIZE + (rlocn ? rlocn->size : 0) + mdac->rlocn.size >= mdah->size)) {
|
||||
log_error("VG %s metadata too large for circular buffer",
|
||||
vg->name);
|
||||
goto out;
|
||||
|
Loading…
Reference in New Issue
Block a user