public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Lukáš Czerner" <lczerner@redhat.com>
To: "Theodore Ts'o" <tytso@mit.edu>
Cc: Ext4 Developers List <linux-ext4@vger.kernel.org>
Subject: Re: [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps
Date: Tue, 29 Apr 2014 13:02:07 +0200 (CEST)	[thread overview]
Message-ID: <alpine.LFD.2.00.1404291259500.2183@localhost.localdomain> (raw)
In-Reply-To: <1398694179-18027-1-git-send-email-tytso@mit.edu>

On Mon, 28 Apr 2014, Theodore Ts'o wrote:

> Date: Mon, 28 Apr 2014 10:09:38 -0400
> From: Theodore Ts'o <tytso@mit.edu>
> To: Ext4 Developers List <linux-ext4@vger.kernel.org>
> Cc: Theodore Ts'o <tytso@mit.edu>
> Subject: [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the
>     flexbg_offset wraps
> 
> 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;

Not sure about this, but I just wonder whether this would work with
bigalloc file system as well since it is true that we're testing
blocks in this condition but in ext2fs_test_block_bitmap_range2()
we're searching for a free cluster.

-Lukas

>  
>  	start_blk = ext2fs_group_first_block2(fs, flexbg_size * flexbg);
> 

  parent reply	other threads:[~2014-04-29 11:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Lukáš Czerner [this message]
2014-04-30  2:34   ` [PATCH 1/2] libext2fs: fix alloc_allocate_group_table() if the flexbg_offset wraps Theodore Ts'o

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.2.00.1404291259500.2183@localhost.localdomain \
    --to=lczerner@redhat.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox