From: Hugh Dickins Date: Thu, 7 Dec 2006 04:41:30 +0000 (-0800) Subject: [PATCH] ext3 balloc: fix _with_rsv freeze X-Git-Tag: v2.6.20-rc1~145^2^2~14 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7d1c520bb57e4b5e94ec937c13553dccf473341b;p=linux-2.6 [PATCH] ext3 balloc: fix _with_rsv freeze Port fix to the off-by-one in find_next_usable_block's memscan from ext2 to ext3; but it didn't cause a serious problem for ext3 because the additional ext3_test_allocatable check rescued it from the error. Signed-off-by: Mingming Cao Signed-off-by: Hugh Dickins Cc: Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/fs/ext3/balloc.c b/fs/ext3/balloc.c index 5a2c198762..22161740ba 100644 --- a/fs/ext3/balloc.c +++ b/fs/ext3/balloc.c @@ -730,7 +730,7 @@ find_next_usable_block(ext3_grpblk_t start, struct buffer_head *bh, here = 0; p = ((char *)bh->b_data) + (here >> 3); - r = memscan(p, 0, (maxblocks - here + 7) >> 3); + r = memscan(p, 0, ((maxblocks + 7) >> 3) - (here >> 3)); next = (r - ((char *)bh->b_data)) << 3; if (next < maxblocks && next >= start && ext3_test_allocatable(next, bh))