mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-29 15:22:30 +03:00
lvpoll: improve merge polling
When multiple polling tasks are watching for same LV, clearly when some of them wins the game - other polling tasks will fail. Improve the logic and report success if the merged LV is actually not a merging origin anymore (since likely someone else has already finished merging).
This commit is contained in:
parent
1a451207b8
commit
eadd58a97d
@ -111,9 +111,9 @@ int lvconvert_merge_finish(struct cmd_context *cmd,
|
||||
struct lv_segment *snap_seg = find_snapshot(lv);
|
||||
|
||||
if (!lv_is_merging_origin(lv)) {
|
||||
log_error("Logical volume %s has no merging snapshot.",
|
||||
log_print("Logical volume %s is no longer merging origin, polling has finished.",
|
||||
display_lvname(lv));
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
log_print_unless_silent("Merge of snapshot into logical volume %s has finished.",
|
||||
@ -141,8 +141,11 @@ progress_t poll_merge_progress(struct cmd_context *cmd,
|
||||
{
|
||||
dm_percent_t percent = DM_PERCENT_0;
|
||||
|
||||
if (!lv_is_merging_origin(lv) ||
|
||||
!lv_snapshot_percent(lv, &percent)) {
|
||||
if (!lv_is_merging_origin(lv))
|
||||
/* Nothing to monitor here */
|
||||
return PROGRESS_FINISHED_ALL;
|
||||
|
||||
if (!lv_snapshot_percent(lv, &percent)) {
|
||||
log_error("%s: Failed query for merging percentage. Aborting merge.",
|
||||
display_lvname(lv));
|
||||
return PROGRESS_CHECK_FAILED;
|
||||
|
@ -172,8 +172,13 @@ int wait_for_single_lv(struct cmd_context *cmd, struct poll_operation_id *id,
|
||||
vg = vg_read(cmd, id->vg_name, NULL, READ_FOR_UPDATE, lockd_state, &error_flags, NULL);
|
||||
if (!vg) {
|
||||
/* What more could we do here? */
|
||||
log_error("ABORTING: Can't reread VG for %s error flags %x.", id->display_name, error_flags);
|
||||
ret = 0;
|
||||
if (error_flags & FAILED_NOTFOUND) {
|
||||
log_print_unless_silent("Can't find VG %s. No longer active.", id->display_name);
|
||||
ret = 1;
|
||||
} else {
|
||||
log_error("ABORTING: Can't reread VG for %s error flags %x.", id->display_name, error_flags);
|
||||
ret = 0;
|
||||
}
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user