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

polldaemon.c: modify log levels in report_progress

There's a race when asking lvmpolld about progress_status and
actually reading the progress info from kernel:

Even with lvmpolld being used we read status info from
LVM2 command issued by a user (client side from lvmpolld perspective).
The whole cycle may look like following:

1) set up an operation that requires polling (i.e. pvmove /dev/sda)
2) notify lvmpolld about such operation (lvmpolld_poll_init())
3) in case 1) was not called with --background it would continue with:
4) Ask lvmpolld about progress status. it may respond with one of:
   a) in_progress
   b) not_found
   c) finished
   d) any low level error

5) provided the answer was 4a) try to read progress info from polling LV
(i.e. vg00/pvmove1). Repeat steps 4) and 5) until the answer is != 4a).

And now we got into racy configuration: lvmpolld answered with in_progress
but it may be the that in_between 4) and 5) the operation has already
finished and polling LV is already gone or there's nothing to ask for.
Up to now, 5) would report warning and it could print such warning many
times if --interval was set to 0.

We don't want to scary users by warnings in such situation so let's just
print these messages in verbose mode. Error messages due to error while
reading kernel status info (on existing, active and locked LV) remained
the same.
This commit is contained in:
Ondrej Kozina 2015-05-21 10:17:29 +02:00
parent 43224f22e4
commit 01b06cb71b

View File

@ -375,24 +375,19 @@ static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id
if (lv && parms->lv_type && !(lv->status & parms->lv_type)) if (lv && parms->lv_type && !(lv->status & parms->lv_type))
lv = NULL; lv = NULL;
if (!lv && parms->lv_type == PVMOVE) {
log_print_unless_silent("%s: No pvmove in progress - already finished or aborted.",
id->display_name);
unlock_and_release_vg(cmd, vg, vg->name);
return 1;
}
if (!lv) { if (!lv) {
log_warn("Can't find LV in %s for %s. Already finished or removed.", if (parms->lv_type == PVMOVE)
log_verbose("%s: No pvmove in progress - already finished or aborted.",
id->display_name);
else
log_verbose("Can't find LV in %s for %s. Already finished or removed.",
vg->name, id->display_name); vg->name, id->display_name);
unlock_and_release_vg(cmd, vg, vg->name); goto out;
return 1;
} }
if (!lv_is_active_locally(lv)) { if (!lv_is_active_locally(lv)) {
log_print_unless_silent("%s: Interrupted: No longer active.", id->display_name); log_verbose("%s: Interrupted: No longer active.", id->display_name);
unlock_and_release_vg(cmd, vg, vg->name); goto out;
return 1;
} }
if (parms->poll_fns->poll_progress(cmd, lv, id->display_name, parms) == PROGRESS_CHECK_FAILED) { if (parms->poll_fns->poll_progress(cmd, lv, id->display_name, parms) == PROGRESS_CHECK_FAILED) {
@ -400,6 +395,7 @@ static int report_progress(struct cmd_context *cmd, struct poll_operation_id *id
return_0; return_0;
} }
out:
unlock_and_release_vg(cmd, vg, vg->name); unlock_and_release_vg(cmd, vg, vg->name);
return 1; return 1;