All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zdenek Kabelac <zkabelac@sourceware.org>
To: lvm-devel@redhat.com
Subject: main - lvpoll: improve merge polling
Date: Mon, 15 Mar 2021 10:14:16 +0000 (GMT)	[thread overview]
Message-ID: <20210315101416.1430C3858D29@sourceware.org> (raw)

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;
 		}
 



                 reply	other threads:[~2021-03-15 10:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210315101416.1430C3858D29@sourceware.org \
    --to=zkabelac@sourceware.org \
    --cc=lvm-devel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.