Re: "Unknown code" error when enabling metadata_csum on ext4 raid1 device

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

On Mon, Jul 30, 2012 at 09:53:15PM -0500, Nick Semenkovich wrote:
> I'm trying to enable metadata_csum on an ext4 raid1 device, but end up
> with a semi-cryptic error.
> (This is probably the same thing Tomasz Chmielewski reported in
> )
> Is this issue being tracked someplace?
> $ uname -ar
> Linux dev 3.5.0-6-generic #6-Ubuntu SMP Mon Jul 23 19:52:14 UTC 2012
> x86_64 x86_64 x86_64 GNU/Linux
> $ git clone git://
> $ ./configure
> [snip]
> $ make progs
> [snip]
> $ sudo misc/tune2fs -O metadata_csum /dev/md1
> tune2fs 1.42.3 (14-May-2012)
> rewrite_directory: Unknown code Ijv 64 while rewriting directories
> The error code changes when I re-run tune2fs (to [a-zA-Z]*3 64).
> I've tried this on the master, "next", & "pu" git branches, all with errors.
> $ debugfs -R 'stats' /dev/md1 >

[CC to Tomasz, Ted, and Darrick]

Hi Nick and Tomasz,

Could you please try this patch?  It seems that the problem is because
error code doesn't be clear.


Subject: [PATCH] tune2fs: clear error code before rewriting directory when metadata_csum enabled

From: Zheng Liu <wenqing.lz@xxxxxxxxxx>

When we enable metadata_csum feature in tune2fs, all inodes need to be rewrited
to calculate checksum.  In this process, the inode that has been removed also
needs to calculate checksum, but the extent tree in these inodes has been clear.
Thus, we cannot read any extents, and an 'EXT2_ET_EXTENT_NO_NEXT' error is
returned back.  But in this condition error code in rewrite_dir_context doesn't
be initialized, and it causes an unknown error.

we can use this script to reproduce this bug:



mkfs.ext4 $dev
mount -t ext4 $dev $mnt # without metadata_csum feature

mkdir -p $mnt/test/1
mkdir $mnt/test/2
echo "hello" > $mnt/test/1/hello
rm -rf $mnt/*
umount $mnt
tune2fs -O metadata_csum $dev

CC: Nick Semenkovich <semenko@xxxxxxxxxxxx>
CC: Tomasz Chmielewski <mangoo@xxxxxxxx>
CC: "Theodore Ts'o" <tytso@xxxxxxx>
CC: Darrick J. Wong <djwong@xxxxxxxxxx>
Signed-off-by: Zheng Liu <wenqing.lz@xxxxxxxxxx>
 misc/tune2fs.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 6a48009..41a5529 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -592,6 +592,7 @@ errcode_t rewrite_directory(ext2_filsys fs, ext2_ino_t dir,
 	ctx.is_htree = (inode->i_flags & EXT2_INDEX_FL);
 	ctx.dir = dir;
+	ctx.errcode = 0;
 	retval = ext2fs_block_iterate3(fs, dir, BLOCK_FLAG_READ_ONLY |
 				       0, rewrite_dir_block, &ctx);

To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at

[Reiser Filesystem Development]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Photo]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux