Skip to content

Commit d048757

Browse files
committed
Merge tag 'md-6.10-20240502' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md into for-6.10/block
Pull MD fix from Song: "This fixes an issue observed with dm-raid." * tag 'md-6.10-20240502' of https://git.kernel.org/pub/scm/linux/kernel/git/song/md: md: fix resync softlockup when bitmap size is less than array size
2 parents d758014 + f0e729a commit d048757

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/md/md-bitmap.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1424,7 +1424,7 @@ __acquires(bitmap->lock)
14241424
sector_t chunk = offset >> bitmap->chunkshift;
14251425
unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
14261426
unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT;
1427-
sector_t csize;
1427+
sector_t csize = ((sector_t)1) << bitmap->chunkshift;
14281428
int err;
14291429

14301430
if (page >= bitmap->pages) {
@@ -1433,6 +1433,7 @@ __acquires(bitmap->lock)
14331433
* End-of-device while looking for a whole page or
14341434
* user set a huge number to sysfs bitmap_set_bits.
14351435
*/
1436+
*blocks = csize - (offset & (csize - 1));
14361437
return NULL;
14371438
}
14381439
err = md_bitmap_checkpage(bitmap, page, create, 0);
@@ -1441,8 +1442,7 @@ __acquires(bitmap->lock)
14411442
bitmap->bp[page].map == NULL)
14421443
csize = ((sector_t)1) << (bitmap->chunkshift +
14431444
PAGE_COUNTER_SHIFT);
1444-
else
1445-
csize = ((sector_t)1) << bitmap->chunkshift;
1445+
14461446
*blocks = csize - (offset & (csize - 1));
14471447

14481448
if (err < 0)

0 commit comments

Comments
 (0)