Fix reiserfs oops on small fs
Jan Kara
reviewerPATCH 1/1 Fix reiserfs oops on small fs
Hello!
Attached patch fixes oops of reiserfs on a filesystem with just one
bitmap block - current code always tries to return second bitmap even if there's not any. Could someone review it please so that it can be merged in mainline?
Honza
Fix block allocation code of reiserfs to give correct bitmap numbers for small filesystems (with just one bitmap block).
fs/reiserfs/bitmap.c +5 -2
@@ -229,6 +229,9 @@ static int bmap_hash_id(struct super_blounsigned long hash;unsigned bm; +/* If there is only one bitmap, we have no choice... */ +if (SB_BMAP_NR (s) ==1 ) +return 0 ;if (id <=2 ) { bm =1 ; }else {
@@ -613,7 +616,7 @@ dirid_groups (reiserfs_blocknr_hint_t *h/* give a portion of the block group to metadata */ if (hint->inode) hash += sb->s_blocksize/2 ; - hint->search_start = hash; + hint->search_start = hash >=SB_BLOCK_COUNT (sb) ?SB_BLOCK_COUNT (sb)-1 : hash; } }
@@ -642,7 +645,7 @@ oid_groups (reiserfs_blocknr_hint_t *hin bm =bmap_hash_id (hint->inode->i_sb, oid); hash = bm * (hint->inode->i_sb->s_blocksize <<3 ); } - hint->search_start = hash; + hint->search_start = hash >=SB_BLOCK_COUNT (hint->inode->i_sb) ?SB_BLOCK_COUNT (hint->inode->i_sb)-1 : hash; } }
Quoted 6 lines · Jan Kara
Hello!
Attached patch fixes oops of reiserfs on a filesystem with just one
bitmap block - current code always tries to return second bitmap even if there's not any. Could someone review it please so that it can be merged in mainline?
Hi Jan,
A slightly different form of this patch is in already. Look for the checks in bmap_hash_id. Are you still able to reproduce this bug on kernels newer than October 18?
-chris
Jan Kara
reviewerQuoted 11 lines · Jan Kara
Quoted 6 lines
Hello!
Attached patch fixes oops of reiserfs on a filesystem with just one
bitmap block - current code always tries to return second bitmap even if there's not any. Could someone review it please so that it can be merged in mainline?A slightly different form of this patch is in already. Look for the checks in
bmap_hash_id. Are you still able to reproduce this bug on kernels newer than October 18?
Sorry. I've missed that the bug was already fixed in the other place.
It looks OK now.
Honza
Signature · 2 lines
Jan Kara <[email protected]> SuSE CR Labs