linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps
@ 2014-04-28 14:09 Theodore Ts'o
  2014-04-28 14:09 ` [PATCH 2/2] resize2fs: fix inode table move for the backwards move case Theodore Ts'o
  2014-04-29 11:02 ` [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps Lukáš Czerner
  0 siblings, 2 replies; 4+ messages in thread
From: Theodore Ts'o @ 2014-04-28 14:09 UTC (permalink / raw)
  To: Ext4 Developers List; +Cc: Theodore Ts'o

If the previous block group's inode table ends at the very end of file
system, wrap around to the beginning of the flex_bg.

This fixes a bug was tickled by:

mke2fs.conf:
	frontload = {
		features = extent,huge_file,flex_bg,uninit_bg,dir_nlink,extra_isize,^resize_inode,sparse_super2
		hash_alg = half_md4
		num_backup_sb = 0
		packed_meta_blocks = 1
		inode_ratio = 4194304
		flex_bg_size = 262144
	}

mke2fs -T frontload /tmp/foo.img 2T
resize2fs -M /tmp/foo.img
resize2fs -M /tmp/foo.img

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
---
 lib/ext2fs/alloc_tables.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/ext2fs/alloc_tables.c b/lib/ext2fs/alloc_tables.c
index fec9003..bc99943 100644
--- a/lib/ext2fs/alloc_tables.c
+++ b/lib/ext2fs/alloc_tables.c
@@ -54,8 +54,8 @@ static blk64_t flexbg_offset(ext2_filsys fs, dgrp_t group, blk64_t start_blk,
 	 * Don't do a long search if the previous block
 	 * search is still valid.
 	 */
-	if (start_blk && ext2fs_test_block_bitmap_range2(bmap, start_blk,
-							 elem_size))
+	if (start_blk && start_blk < ext2fs_blocks_count(fs->super) &&
+	    ext2fs_test_block_bitmap_range2(bmap, start_blk, elem_size))
 		return start_blk;
 
 	start_blk = ext2fs_group_first_block2(fs, flexbg_size * flexbg);
-- 
1.9.0


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-04-30  2:34 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-28 14:09 [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps Theodore Ts'o
2014-04-28 14:09 ` [PATCH 2/2] resize2fs: fix inode table move for the backwards move case Theodore Ts'o
2014-04-29 11:02 ` [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps Lukáš Czerner
2014-04-30  2:34   ` Theodore Ts'o

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).