summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Teigland <teigland@redhat.com>2016-01-18 15:40:42 -0600
committerDavid Teigland <teigland@redhat.com>2016-01-18 16:09:22 -0600
commit6b3e402298080a4b3e352ecee3a33cd916d18b6b (patch)
treedfe88274770c358c48876da19abf9ddf6d194f63
parenta3f484f812bfb89063fbc25e378f34cacd50bf7d (diff)
downloadlvm2-6b3e402298080a4b3e352ecee3a33cd916d18b6b.tar.gz
toollib: add comment about missing device
Add a comment in _process_pvs_in_vg() to document the place where there have been problems with processing PVs twice. For a while we had a hacky workaround here where we'd skip processing a PV if its device wasn't found in all_devices (and !is_missing_pv since we want to process PVs with missing devices.). That workaround was removed in commit 5cd4d46f because it was no longer needed. The workaround had originally been needed to prevent a device from being processed twice when the PV had no MDAs -- it would be processed once in its real VG and then the workaround would prevent it from being processed a second time in the orphan VG. Wrongly appearing as an orphan likely happened because lvmcache would consider the no-MDA PV an orphan unless the real VG holding that PV was also in lvmcache. This issue is also mentioned in pvchange where holding the global lock allows VGs to remain in lvmcache so PVs with 0 mdas are not considered orphans. The workaround in _process_pvs_in_vg() was originally intended for reporting commands, not for pvchange. But, it was accidentally helping pvchange also because the method described by the pvchange global lock comment had been subverted by commit 80f4b4b8. Commit 80f4b4b8 was found to be unnecessary, and was reverted in commit e710bac0. This restored the intended global lock lvmcache effect to pvchange, and it no longer relied on the workaround in toollib.
-rw-r--r--tools/toollib.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/toollib.c b/tools/toollib.c
index 97cc1bf6e..dec9106a3 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -3088,6 +3088,16 @@ static int _process_pvs_in_vg(struct cmd_context *cmd,
_device_list_remove(all_devices, pv->dev);
+ /*
+ * pv->dev should be found in all_devices unless it's a
+ * case of a "missing device". Previously there have
+ * been cases where we needed to skip processing the PV
+ * if pv->dev was not found in all_devices to avoid
+ * processing a PV twice, i.e. when the PV had no MDAs
+ * it would be seen once in its real VG and again
+ * wrongly in the orphan VG. This no longer happens.
+ */
+
if (!skip) {
ret = process_single_pv(cmd, vg, pv, handle);
if (ret != ECMD_PROCESSED)