[parted-devel] [PATCH] Fix block state checking for realocated blocks

Jim Meyering jim at meyering.net
Tue Jun 12 18:21:32 UTC 2007


Flavio Leitner <flavio.leitner at gmail.com> wrote:

> Hi there,
>
> A busy block should be realocated and it's correct in
> ext2_block_relocator_mark(), but not in ext2_metadata_push().
>
> Signed-off-by: Flavio Leitner <flavio.leitner at gmail.com>
>
> diff --git a/libparted/fs/ext2/ext2_meta.c b/libparted/fs/ext2/ext2_meta.c
> index d48097c..dd871c8 100644
> --- a/libparted/fs/ext2/ext2_meta.c
> +++ b/libparted/fs/ext2/ext2_meta.c
> @@ -65,7 +65,7 @@ int ext2_metadata_push(struct ext2_fs *fs, blk_t newsize)
>  		if (fs->opt_debug)
>  		{
>  			for (j=0;j<diff;j++)
> -				if (ext2_get_block_state(fs, fromblock+j))
> +				if (!ext2_get_block_state(fs, fromblock+j))
>  				{
>  					fprintf(stderr,
>  						"error: block relocator "

Thanks for the patch!
Yep, lots of duplication.  Good catch.
Can you provide a test case to trigger this bug?



More information about the parted-devel mailing list