All of lore.kernel.org
 help / color / mirror / Atom feed
* [dm-devel] [PATCH] dm mirror: fix regression caused by
@ 2022-06-23 18:53 Mikulas Patocka
  0 siblings, 0 replies; only message in thread
From: Mikulas Patocka @ 2022-06-23 18:53 UTC (permalink / raw)
  To: Mike Snitzer; +Cc: dm-devel

The commit 85e123c27d5c introduced a regression on 64-bit architectures in
the lvm testsuite tests lvcreate-mirror, mirror-names and
vgsplit-operation.

If the device is shrunk, we need to clear log bits beyond the end of the 
device. The code clears bits up to a 32-bit boundary and then calculates 
lc->sync_count by summing set bits up to a 64-bit boundary (that commit 
changed that; previously, this boundary was 32-bit too). So, it was using 
some non-zeroed bits in the calculation and this caused misbehavior.

We fix this bug by clearing bits up to BITS_PER_LONG boundary.

Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Fixes: 85e123c27d5c ("dm mirror log: round up region bitmap size to BITS_PER_LONG")
Cc: stable@vger.kernel.org

---
 drivers/md/dm-log.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: linux-2.6/drivers/md/dm-log.c
===================================================================
--- linux-2.6.orig/drivers/md/dm-log.c	2022-06-23 20:32:05.000000000 +0200
+++ linux-2.6/drivers/md/dm-log.c	2022-06-23 20:33:42.000000000 +0200
@@ -615,7 +615,7 @@ static int disk_resume(struct dm_dirty_l
 			log_clear_bit(lc, lc->clean_bits, i);
 
 	/* clear any old bits -- device has shrunk */
-	for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++)
+	for (i = lc->region_count; i % BITS_PER_LONG; i++)
 		log_clear_bit(lc, lc->clean_bits, i);
 
 	/* copy clean across to sync */
--
dm-devel mailing list
dm-devel@redhat.com
https://listman.redhat.com/mailman/listinfo/dm-devel


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

only message in thread, other threads:[~2022-06-23 18:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-23 18:53 [dm-devel] [PATCH] dm mirror: fix regression caused by Mikulas Patocka

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.