[lvm-devel] master - pvck: fix reading large mda1

David Teigland teigland at sourceware.org
Wed Mar 4 14:58:42 UTC 2020


Gitweb:        https://sourceware.org/git/?p=lvm2.git;a=commitdiff;h=f140620043eb22b192e7d87e17a42fcd0a3656a1
Commit:        f140620043eb22b192e7d87e17a42fcd0a3656a1
Parent:        c6746181a3c2c40447f5a33e15359b57567f8217
Author:        David Teigland <teigland at redhat.com>
AuthorDate:    Mon Mar 2 15:22:39 2020 -0600
Committer:     David Teigland <teigland at redhat.com>
CommitterDate: Tue Mar 3 13:47:07 2020 -0600

pvck: fix reading large mda1

When mda_size is larger than io_memory_size, reading
the entire mda fails unless the previous read of the
label has been invalidated.
---
 tools/pvck.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/tools/pvck.c b/tools/pvck.c
index ab85537..79e3af5 100644
--- a/tools/pvck.c
+++ b/tools/pvck.c
@@ -981,6 +981,13 @@ static int _dump_label_and_pv_header(struct cmd_context *cmd, uint64_t labelsect
 		return 0;
 	}
 
+	/*
+	 * Not invalidating this range can cause an error reading
+	 * a larger range that overlaps this.
+	 */
+	if (!dev_invalidate_bytes(dev, lh_offset, 512))
+		stack;
+
 	lh = (struct label_header *)buf;
 
 	if (print_fields) {





More information about the lvm-devel mailing list