diff options
author | Jens Axboe <axboe@kernel.dk> | 2024-05-03 01:22:58 +0300 |
---|---|---|
committer | Jens Axboe <axboe@kernel.dk> | 2024-05-03 01:22:58 +0300 |
commit | d0487577e6e0b640d71375a6ec2f9e8a2d3555f2 (patch) | |
tree | a647006963c50ec5c96562da64ac7f797179c721 /drivers/md | |
parent | d7580149efc5c86c4e72f9263b97c062616a84dd (diff) | |
parent | f0e729af2eb6bee9eb58c4df1087f14ebaefe26b (diff) | |
download | linux-d0487577e6e0b640d71375a6ec2f9e8a2d3555f2.tar.xz |
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
Diffstat (limited to 'drivers/md')
-rw-r--r-- | drivers/md/md-bitmap.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/md/md-bitmap.c b/drivers/md/md-bitmap.c index 059afc24c08b..0a2d37eb38ef 100644 --- a/drivers/md/md-bitmap.c +++ b/drivers/md/md-bitmap.c @@ -1424,7 +1424,7 @@ __acquires(bitmap->lock) sector_t chunk = offset >> bitmap->chunkshift; unsigned long page = chunk >> PAGE_COUNTER_SHIFT; unsigned long pageoff = (chunk & PAGE_COUNTER_MASK) << COUNTER_BYTE_SHIFT; - sector_t csize; + sector_t csize = ((sector_t)1) << bitmap->chunkshift; int err; if (page >= bitmap->pages) { @@ -1433,6 +1433,7 @@ __acquires(bitmap->lock) * End-of-device while looking for a whole page or * user set a huge number to sysfs bitmap_set_bits. */ + *blocks = csize - (offset & (csize - 1)); return NULL; } err = md_bitmap_checkpage(bitmap, page, create, 0); @@ -1441,8 +1442,7 @@ __acquires(bitmap->lock) bitmap->bp[page].map == NULL) csize = ((sector_t)1) << (bitmap->chunkshift + PAGE_COUNTER_SHIFT); - else - csize = ((sector_t)1) << bitmap->chunkshift; + *blocks = csize - (offset & (csize - 1)); if (err < 0) |