Unverified Commit c071fab7 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!9805 md: fix resync softlockup when bitmap size is less than array size

parents 01c2a11a 6260b06e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -1427,7 +1427,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) {
@@ -1436,6 +1436,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);
@@ -1444,8 +1445,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)