1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-03-10 16:58:47 +03:00

cope with volatile vginfo in vg_read

This commit is contained in:
Alasdair Kergon 2008-06-06 11:12:50 +00:00
parent 57d0dc0db2
commit d0de492ff3
2 changed files with 10 additions and 1 deletions

View File

@ -243,6 +243,9 @@ struct lvmcache_vginfo *vginfo_from_vgname(const char *vgname, const char *vgid)
{
struct lvmcache_vginfo *vginfo;
if (!vgname)
return vginfo_from_vgid(vgid);
if (!_vgname_hash)
return NULL;

View File

@ -1476,6 +1476,8 @@ static int _update_pv_list(struct list *all_pvs, struct volume_group *vg)
* and call vg_read again).
*
* If precommitted is set, use precommitted metadata if present.
*
* Either of vgname or vgid may be NULL.
*/
static struct volume_group *_vg_read(struct cmd_context *cmd,
const char *vgname,
@ -1522,6 +1524,10 @@ static struct volume_group *_vg_read(struct cmd_context *cmd,
}
}
/* Now determine the correct vgname if none was supplied */
if (!vgname && !(vgname = vgname_from_vgid(cmd->mem, vgid)))
return_NULL;
if (use_precommitted && !(fmt->features & FMT_PRECOMMIT))
use_precommitted = 0;
@ -1752,7 +1758,7 @@ static struct volume_group *_vg_read_by_vgid(struct cmd_context *cmd,
/* Is corresponding vgname already cached? */
if ((vginfo = vginfo_from_vgid(vgid)) &&
vginfo->vgname && !is_orphan_vg(vginfo->vgname)) {
if ((vg = _vg_read(cmd, vginfo->vgname, vgid,
if ((vg = _vg_read(cmd, NULL, vgid,
&consistent, precommitted)) &&
!strncmp((char *)vg->id.uuid, vgid, ID_LEN)) {
if (!consistent) {