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

metadata: Consistently skip metadata areas that failed.

Even after writing some metadata encountered problems, some commands
continue (rightly or wrongly) and attempt to make further changes.

Once an mda is marked MDA_FAILED, don't try to use it again.
This also applies when reverting, where one loop already skips
failed mdas but the other doesn't.

This fixes some device open_count warnings on relevant failure paths.
This commit is contained in:
Alasdair G Kergon 2017-12-12 17:49:35 +00:00
parent 15ccea7111
commit b96862ee11
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.177 -
====================================
When writing metadata, consistently skip mdas marked as failed.
Refactor and adjust text format metadata alignment calculation.
Fix python3 path in lvmdbusd to use value detected by configure.
Reduce checks for active LVs in vgchange before background polling.

View File

@ -3039,6 +3039,8 @@ int vg_write(struct volume_group *vg)
/* Write to each copy of the metadata area */
dm_list_iterate_items(mda, &vg->fid->metadata_areas_in_use) {
if (mda->status & MDA_FAILED)
continue;
if (!mda->ops->vg_write) {
log_error("Format does not support writing volume"
"group metadata areas");
@ -3063,6 +3065,9 @@ int vg_write(struct volume_group *vg)
dm_list_uniterate(mdah, &vg->fid->metadata_areas_in_use, &mda->list) {
mda = dm_list_item(mdah, struct metadata_area);
if (mda->status & MDA_FAILED)
continue;
if (mda->ops->vg_revert &&
!mda->ops->vg_revert(vg->fid, vg, mda)) {
stack;