All of lore.kernel.org
 help / color / mirror / Atom feed
* master - integrity: fix block size check when inactive
@ 2020-06-11 18:06 David Teigland
  0 siblings, 0 replies; only message in thread
From: David Teigland @ 2020-06-11 18:06 UTC (permalink / raw)
  To: lvm-devel

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



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

only message in thread, other threads:[~2020-06-11 18:06 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-11 18:06 master - integrity: fix block size check when inactive David Teigland

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.