All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Teigland <teigland@sourceware.org>
To: lvm-devel@redhat.com
Subject: master - integrity: fix block size check when inactive
Date: Thu, 11 Jun 2020 18:06:39 +0000 (GMT)	[thread overview]
Message-ID: <20200611180639.E4E013898528@sourceware.org> (raw)

Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=b528a9ce9060ed8d66466f7df86c0eafa7c94ec8
Commit:        b528a9ce9060ed8d66466f7df86c0eafa7c94ec8
Parent:        9fbad5bb0fdc7d9a9dca8539e4cd217c5ef1fede
Author:        David Teigland <teigland@redhat.com>
AuthorDate:    Thu Jun 11 12:43:52 2020 -0500
Committer:     David Teigland <teigland@redhat.com>
CommitterDate: Thu Jun 11 12:43:52 2020 -0500

integrity: fix block size check when inactive

Checking fs block size requires the LV to be active.
---
 lib/metadata/integrity_manip.c | 22 +++++++++++++++++++++-
 1 file changed, 21 insertions(+), 1 deletion(-)

diff --git a/lib/metadata/integrity_manip.c b/lib/metadata/integrity_manip.c
index 7942be0d6..790642dbb 100644
--- a/lib/metadata/integrity_manip.c
+++ b/lib/metadata/integrity_manip.c
@@ -587,13 +587,33 @@ int lv_add_integrity_to_raid(struct logical_volume *lv, struct integrity_setting
 		}
 	}
 
+	if (!is_active) {
+		/* checking block size of fs on the lv requires the lv to be active */
+		if (!activate_lv(cmd, lv)) {
+			log_error("Failed to activate LV to check block size %s", display_lvname(lv));
+			goto bad;
+		}
+		if (!sync_local_dev_names(cmd))
+			stack;
+	}
+
 	/*
 	 * Set settings->block_size which will be copied to segment settings below.
 	 * integrity block size chosen based on device logical block size and
 	 * file system block size.
 	 */
-	if (!_set_integrity_block_size(cmd, lv, settings, lbs_4k, lbs_512, pbs_4k, pbs_512))
+	if (!_set_integrity_block_size(cmd, lv, settings, lbs_4k, lbs_512, pbs_4k, pbs_512)) {
+		if (!is_active && !deactivate_lv(cmd, lv))
+			stack;
 		goto_bad;
+	}
+
+	if (!is_active) {
+		if (!deactivate_lv(cmd, lv)) {
+			log_error("Failed to deactivate LV after checking block size %s", display_lvname(lv));
+			goto bad;
+		}
+	}
 
 	/*
 	 * For each rimage, move its segments to a new rimage_iorig and give



                 reply	other threads:[~2020-06-11 18:06 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=20200611180639.E4E013898528@sourceware.org \
    --to=teigland@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.