Commit d0487577 authored by Jens Axboe's avatar Jens Axboe

Merge tag 'md-6.10-20240502' of...

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
parents d7580149 f0e729af
...@@ -1424,7 +1424,7 @@ __acquires(bitmap->lock) ...@@ -1424,7 +1424,7 @@ __acquires(bitmap->lock)
sector_t chunk = offset >> bitmap->chunkshift; sector_t chunk = offset >> bitmap->chunkshift;
unsigned long page = chunk >> PAGE_COUNTER_SHIFT; unsigned long page = chunk >> PAGE_COUNTER_SHIFT;
unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT; unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT;
sector_t csize; sector_t csize = ((sector_t)1) << bitmap->chunkshift;
int err; int err;
if (page >= bitmap->pages) { if (page >= bitmap->pages) {
...@@ -1433,6 +1433,7 @@ __acquires(bitmap->lock) ...@@ -1433,6 +1433,7 @@ __acquires(bitmap->lock)
* End-of-device while looking for a whole page or * End-of-device while looking for a whole page or
* user set a huge number to sysfs bitmap_set_bits. * user set a huge number to sysfs bitmap_set_bits.
*/ */
*blocks = csize - (offset & (csize - 1));
return NULL; return NULL;
} }
err = md_bitmap_checkpage(bitmap, page, create, 0); err = md_bitmap_checkpage(bitmap, page, create, 0);
...@@ -1441,8 +1442,7 @@ __acquires(bitmap->lock) ...@@ -1441,8 +1442,7 @@ __acquires(bitmap->lock)
bitmap->bp[page].map == NULL) bitmap->bp[page].map == NULL)
csize = ((sector_t)1) << (bitmap->chunkshift + csize = ((sector_t)1) << (bitmap->chunkshift +
PAGE_COUNTER_SHIFT); PAGE_COUNTER_SHIFT);
else
csize = ((sector_t)1) << bitmap->chunkshift;
*blocks = csize - (offset & (csize - 1)); *blocks = csize - (offset & (csize - 1));
if (err < 0) if (err < 0)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment