mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-02 01:18:26 +03:00
vg_write: shift check for exported metadata
Since we now immediatelly use created buffer for CFT creation, the result needs to be validate before such use.
This commit is contained in:
parent
17802084c9
commit
d2a3bfe6ca
@ -661,6 +661,11 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
|
|||||||
(void) dm_snprintf(desc, sizeof(desc), "Write[%u] from %s.", vg->write_count, vg->cmd->cmd_line);
|
(void) dm_snprintf(desc, sizeof(desc), "Write[%u] from %s.", vg->write_count, vg->cmd->cmd_line);
|
||||||
|
|
||||||
new_size = text_vg_export_raw(vg, desc, &write_buf, &write_buf_size);
|
new_size = text_vg_export_raw(vg, desc, &write_buf, &write_buf_size);
|
||||||
|
if (!new_size || !write_buf) {
|
||||||
|
log_error("VG %s metadata writing failed", vg->name);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
fidtc->write_buf = write_buf;
|
fidtc->write_buf = write_buf;
|
||||||
fidtc->write_buf_size = write_buf_size;
|
fidtc->write_buf_size = write_buf_size;
|
||||||
fidtc->new_metadata_size = new_size;
|
fidtc->new_metadata_size = new_size;
|
||||||
@ -681,11 +686,6 @@ static int _vg_write_raw(struct format_instance *fid, struct volume_group *vg,
|
|||||||
goto_out;
|
goto_out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!new_size || !write_buf) {
|
|
||||||
log_error("VG %s metadata writing failed", vg->name);
|
|
||||||
goto out;
|
|
||||||
}
|
|
||||||
|
|
||||||
log_debug_metadata("VG %s seqno %u metadata write to %s mda_start %llu mda_size %llu mda_last %llu",
|
log_debug_metadata("VG %s seqno %u metadata write to %s mda_start %llu mda_size %llu mda_last %llu",
|
||||||
vg->name, vg->seqno, devname,
|
vg->name, vg->seqno, devname,
|
||||||
(unsigned long long)mda_start,
|
(unsigned long long)mda_start,
|
||||||
|
Loading…
Reference in New Issue
Block a user