* this means checking every VG by scanning every PV on the
* system.
*/
- if (pv && is_orphan(pv) && !dm_list_size(&mdas)) {
+ if (pv && is_orphan(pv) && mdas_empty_or_ignored(&mdas)) {
if (!scan_vgs_for_pvs(cmd))
return_0;
pv = pv_read(cmd, name, NULL, NULL, 0, 0);
return NULL;
}
- if (is_orphan_vg(pv->vg_name) && !dm_list_size(&mdas)) {
+ if (is_orphan_vg(pv->vg_name) && mdas_empty_or_ignored(&mdas)) {
/* If a PV has no MDAs - need to search all VGs for it */
if (!scan_vgs_for_pvs(cmd))
return_NULL;
/* Ensure every PV in the VG was in the cache */
if (correct_vg) {
/*
- * If the VG has PVs without mdas, they may still be
- * orphans in the cache: update the cache state here.
+ * If the VG has PVs without mdas, or ignored mdas, they may
+ * still be orphans in the cache: update the cache state here.
*/
if (!inconsistent &&
dm_list_size(&correct_vg->pvs) > dm_list_size(pvids)) {
/*
* PV not marked as belonging to this VG in cache.
- * Check it's an orphan without metadata area.
+ * Check it's an orphan without metadata area
+ * not ignored.
*/
if (!(info = info_from_pvid(pvl->pv->dev->pvid, 1)) ||
!info->vginfo || !is_orphan_vg(info->vginfo->vgname) ||
- dm_list_size(&info->mdas)) {
+ !mdas_empty_or_ignored(&info->mdas)) {
inconsistent_pvs = 1;
break;
}
return_NULL;
}
/*
- * If an orphan PV has no MDAs it may appear to be an
- * orphan until the metadata is read off another PV in
- * the same VG. Detecting this means checking every VG
- * by scanning every PV on the system.
+ * If an orphan PV has no MDAs, or it has MDAs but the
+ * MDA is ignored, it may appear to be an orphan until
+ * the metadata is read off another PV in the same VG.
+ * Detecting this means checking every VG by scanning
+ * every PV on the system.
*/
- if (!dm_list_size(&info->mdas)) {
+ if (mdas_empty_or_ignored(&info->mdas)) {
if (!scan_vgs_for_pvs(cmd)) {
log_error("Rescan for PVs without "
"metadata areas failed.");
return NULL;
}
+ /*
+ * Ask lvmcache again - we may have a non-orphan
+ * name now
+ */
+ vgname = lvmcache_vgname_from_pvid(cmd, pvid);
}
- /* Ask lvmcache again - we may have a non-orphan name now */
- vgname = lvmcache_vgname_from_pvid(cmd, pvid);
}
return vgname;
}