From a5e3f0e6dd6eb9a345ec3aea65658d1177201152 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Thu, 24 Oct 2024 23:00:44 +0200 Subject: [PATCH] metadata: check for mda_device existance --- lib/metadata/metadata.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index ce7420d6d..1a0702f61 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -3028,11 +3028,14 @@ 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) { - mda_dev = mda_get_device(mda); - if (mda->status & MDA_FAILED) continue; + if (!(mda_dev = mda_get_device(mda))) { + log_warn("WARNING: mda without device."); + continue; + } + /* * When the scan and vg_read find old metadata in an mda, they * leave the info struct in lvmcache, and leave the mda in -- 2.43.5