1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

pv_read: add missing check for valid info

If the lvmcache_info_from_pvid() fails to find valid
info, invoke the lookup by dev, and only in this case
call lvmcache_info_from_pvid() again.

Also check for the result of info and return
error directly, so the NULL is not passed
to lvmcache_get_label().
This commit is contained in:
Zdenek Kabelac 2012-12-14 14:06:33 +01:00
parent 3e8dbfaecf
commit 401c9aba4a
2 changed files with 7 additions and 1 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.99 -
===================================
Check lvmcache_info_from_pvid and recall only when needed in _pv_read.
Check for memory failure of dm_config_write_node() in lvmetad.
Fix socket leak on error path in lvmetad's handle_connect.
Check for failing id_read_format() in _pv_populate_lvmcache.

View File

@ -3633,8 +3633,13 @@ static struct physical_volume *_pv_read(struct cmd_context *cmd,
pv_name);
return NULL;
}
if (!(info = lvmcache_info_from_pvid(dev->pvid, 0))) {
if (warnings)
log_error("No cache info in lvmetad cache for %s.",
pv_name);
return NULL;
}
}
info = lvmcache_info_from_pvid(dev->pvid, 0);
label = lvmcache_get_label(info);
} else {
if (!(label_read(dev, &label, UINT64_C(0)))) {