1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-10-27 18:55:19 +03:00

format-text: Avoid a label_scan while in a critical_section().

This commit is contained in:
Petr Rockai 2014-02-18 17:52:05 +01:00
parent 00ce01e52d
commit b391ae88e5

View File

@ -1912,8 +1912,19 @@ static int _create_vg_text_instance(struct format_instance *fid,
}
if (type & FMT_INSTANCE_MDAS) {
/* Scan PVs in VG for any further MDAs */
lvmcache_label_scan(fid->fmt->cmd, 0);
/*
* TODO in theory, this function should be never reached
* while in critical_section(), because lvmcache's
* cached_vg should be valid. However, this assumption
* sometimes fails (possibly due to inconsistent
* (precommit) metadata and/or missing devices), and
* calling lvmcache_label_scan inside the critical
* section may be fatal (i.e. deadlock).
*/
if (!critical_section())
/* Scan PVs in VG for any further MDAs */
lvmcache_label_scan(fid->fmt->cmd, 0);
if (!(vginfo = lvmcache_vginfo_from_vgname(vg_name, vg_id)))
goto_out;
if (!lvmcache_fid_add_mdas_vg(vginfo, fid))