From: Peter Rajnoha Date: Tue, 16 Feb 2016 14:50:32 +0000 (+0100) Subject: metadata: add missing _repair_inconsinstent_vg call during PV ext repair X-Git-Tag: v2_02_143~23 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=065526c59084d3d47de476acee2d095199e9412d;p=lvm2.git metadata: add missing _repair_inconsinstent_vg call during PV ext repair --- diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 3b59e6533..ca7f9c72c 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -3723,6 +3723,8 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd, struct lvmcache_info *info; uint32_t ext_version, ext_flags; struct pv_list *pvl; + unsigned pvs_fixed = 0; + int r = 0; *inconsistent_pvs = 0; @@ -3733,7 +3735,7 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd, if (!(info = lvmcache_info_from_pvid(pvl->pv->dev->pvid, 0))) { log_error("Failed to find cached info for PV %s.", pv_dev_name(pvl->pv)); - return 0; + goto out; } ext_version = lvmcache_ext_version(info); @@ -3744,7 +3746,10 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd, if (!(ext_flags & PV_EXT_USED)) { if (!repair) { *inconsistent_pvs = 1; - continue; + /* we're not repairing now, so no need to + * check further PVs - inconsistent_pvs is already + * set and that will trigger the repair next time */ + return 1; } if (_is_foreign_vg(vg)) { @@ -3762,13 +3767,19 @@ static int _check_or_repair_pv_ext(struct cmd_context *cmd, *inconsistent_pvs = 1; log_error("Failed to repair physical volume \"%s\".", pv_dev_name(pvl->pv)); - return 0; + goto out; } + pvs_fixed++; } } } - return 1; + r = 1; +out: + if ((pvs_fixed > 0) && !_repair_inconsistent_vg(vg)) + return_0; + + return r; } /* Caller sets consistent to 1 if it's safe for vg_read_internal to correct