Skip to content

Commit 90736eb

Browse files
Mikulas PatockaMike Snitzer
authored andcommitted
dm mirror log: clear log bits up to BITS_PER_LONG boundary
Commit 85e123c ("dm mirror log: round up region bitmap size to BITS_PER_LONG") 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 (the 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. Fix this regression by clearing bits up to BITS_PER_LONG boundary. Fixes: 85e123c ("dm mirror log: round up region bitmap size to BITS_PER_LONG") Cc: [email protected] Reported-by: Benjamin Marzinski <[email protected]> Signed-off-by: Mikulas Patocka <[email protected]> Signed-off-by: Mike Snitzer <[email protected]>
1 parent 61b6e2e commit 90736eb

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-log.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -615,7 +615,7 @@ static int disk_resume(struct dm_dirty_log *log)
615615
log_clear_bit(lc, lc->clean_bits, i);
616616

617617
/* clear any old bits -- device has shrunk */
618-
for (i = lc->region_count; i % (sizeof(*lc->clean_bits) << BYTE_SHIFT); i++)
618+
for (i = lc->region_count; i % BITS_PER_LONG; i++)
619619
log_clear_bit(lc, lc->clean_bits, i);
620620

621621
/* copy clean across to sync */

0 commit comments

Comments
 (0)