All of lore.kernel.org
 help / color / mirror / Atom feed
* main - lvpoll: improve merge polling
@ 2021-03-15 10:14 Zdenek Kabelac
  0 siblings, 0 replies; only message in thread
From: Zdenek Kabelac @ 2021-03-15 10:14 UTC (permalink / raw)
  To: lvm-devel

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=eadd58a97dd9a199b74260e8a2bdb5657bf7a88d
Commit:        eadd58a97dd9a199b74260e8a2bdb5657bf7a88d
Parent:        1a451207b8ddbd15519ff9556c59287023ab50fa
Author:        Zdenek Kabelac <zkabelac@redhat.com>
AuthorDate:    Sun Mar 14 22:03:41 2021 +0100
Committer:     Zdenek Kabelac <zkabelac@redhat.com>
CommitterDate: Mon Mar 15 11:13:24 2021 +0100

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).
---
 tools/lvconvert_poll.c | 11 +++++++----
 tools/polldaemon.c     |  9 +++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/tools/lvconvert_poll.c b/tools/lvconvert_poll.c
index 5adb14506..b64cffe21 100644
--- a/tools/lvconvert_poll.c
+++ b/tools/lvconvert_poll.c
@@ -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;
diff --git a/tools/polldaemon.c b/tools/polldaemon.c
index 32733b8ea..c182e548e 100644
--- a/tools/polldaemon.c
+++ b/tools/polldaemon.c
@@ -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;
 		}
 



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-03-15 10:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-15 10:14 main - lvpoll: improve merge polling Zdenek Kabelac

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.