1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

metadata: Detect internal use of LVM_WRITE_LOCKED.

Generate internal error if LVM_WRITE_LOCKED ever appears
in struct volume_group: it's only used in external
metadata.
This commit is contained in:
Alasdair G Kergon 2015-03-09 18:56:24 +00:00
parent faccdeda83
commit a854546234

View File

@ -2495,6 +2495,12 @@ int vg_validate(struct volume_group *vg)
r = 0;
}
if (vg->status & LVM_WRITE_LOCKED) {
log_error(INTERNAL_ERROR "VG %s has external flag LVM_WRITE_LOCKED set internally.",
vg->name);
r = 0;
}
/* FIXME Also check there's no data/metadata overlap */
if (!(vhash.pvid = dm_hash_create(vg->pv_count))) {
log_error("Failed to allocate pvid hash.");
@ -2568,6 +2574,12 @@ int vg_validate(struct volume_group *vg)
dm_list_iterate_items(lvl, &vg->lvs) {
lv_count++;
if (lvl->lv->status & LVM_WRITE_LOCKED) {
log_error(INTERNAL_ERROR "LV %s has external flag LVM_WRITE_LOCKED set internally.",
vg->name);
r = 0;
}
dev_name_len = strlen(lvl->lv->name) + vg_name_len + 3;
if (dev_name_len >= NAME_LEN) {
log_error(INTERNAL_ERROR "LV name \"%s/%s\" length %"