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

lv_info: missing check for info.exists

When &info is passed in, user needs to check for exists.
When there is NULL, return value includes check for exists.
This commit is contained in:
Zdenek Kabelac 2021-03-11 20:38:51 +01:00
parent 3608e8aee7
commit 5141a510bd
2 changed files with 4 additions and 5 deletions

View File

@ -212,7 +212,7 @@ static int _mirrored_transient_status(struct dm_pool *mem, struct lv_segment *se
if (!strcmp(sm->log_type, "disk")) { if (!strcmp(sm->log_type, "disk")) {
log = first_seg(lv)->log_lv; log = first_seg(lv)->log_lv;
if (!lv_info(lv->vg->cmd, log, 0, &info, 0, 0)) { if (!lv_info(lv->vg->cmd, log, 0, &info, 0, 0) || !info.exists) {
log_error("Check for existence of mirror log %s failed.", log_error("Check for existence of mirror log %s failed.",
display_lvname(log)); display_lvname(log));
goto out; goto out;
@ -235,7 +235,7 @@ static int _mirrored_transient_status(struct dm_pool *mem, struct lv_segment *se
} }
for (i = 0; i < seg->area_count; ++i) { for (i = 0; i < seg->area_count; ++i) {
if (!lv_info(lv->vg->cmd, seg_lv(seg, i), 0, &info, 0, 0)) { if (!lv_info(lv->vg->cmd, seg_lv(seg, i), 0, &info, 0, 0) || !info.exists) {
log_error("Check for existence of mirror image %s failed.", log_error("Check for existence of mirror image %s failed.",
seg_lv(seg, i)->name); seg_lv(seg, i)->name);
goto out; goto out;

View File

@ -402,7 +402,6 @@ static int _raid_transient_status(struct dm_pool *mem,
{ {
int failed = 0, r = 0; int failed = 0, r = 0;
unsigned i; unsigned i;
struct lvinfo info;
struct logical_volume *lv; struct logical_volume *lv;
struct dm_status_raid *sr; struct dm_status_raid *sr;
@ -421,7 +420,7 @@ static int _raid_transient_status(struct dm_pool *mem,
if (seg->meta_areas) if (seg->meta_areas)
for (i = 0; i < seg->area_count; ++i) { for (i = 0; i < seg->area_count; ++i) {
lv = seg_metalv(seg, i); lv = seg_metalv(seg, i);
if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 0)) { if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0)) {
log_error("Check for existence of raid meta %s failed.", log_error("Check for existence of raid meta %s failed.",
display_lvname(lv)); display_lvname(lv));
goto out; goto out;
@ -430,7 +429,7 @@ static int _raid_transient_status(struct dm_pool *mem,
for (i = 0; i < seg->area_count; ++i) { for (i = 0; i < seg->area_count; ++i) {
lv = seg_lv(seg, i); lv = seg_lv(seg, i);
if (!lv_info(lv->vg->cmd, lv, 0, &info, 0, 0)) { if (!lv_info(lv->vg->cmd, lv, 0, NULL, 0, 0)) {
log_error("Check for existence of raid image %s failed.", log_error("Check for existence of raid image %s failed.",
display_lvname(lv)); display_lvname(lv));
goto out; goto out;