linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Zheng Liu <gnehzuil.liu@gmail.com>
To: semenko@syndetics.net
Cc: linux-ext4@vger.kernel.org, semenko@alum.mit.edu,
	mangoo@wpkg.org, tytso@mit.edu, djwong@us.ibm.com
Subject: Re: "Unknown code" error when enabling metadata_csum on ext4 raid1 device
Date: Wed, 1 Aug 2012 15:19:35 +0800	[thread overview]
Message-ID: <20120801071935.GA12929@gmail.com> (raw)
In-Reply-To: <CAFepXZhPc0Vw-m0h_U9SnS6=CutOsGbiApe=-PEbKb3dxWOEvw@mail.gmail.com>

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
> http://www.spinics.net/lists/linux-ext4/msg33139.html )
> 
> 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://git.kernel.org/pub/scm/fs/ext2/e2fsprogs.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 >
> http://web.mit.edu/semenko/Public/debugfs-md1.txt

[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.

Regards,
Zheng

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

From: Zheng Liu <wenqing.lz@taobao.com>

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:

#!/bin/sh

dev='/dev/sda1'
mnt='/mnt/sda1'

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@alum.mit.edu>
CC: Tomasz Chmielewski <mangoo@wpkg.org>
CC: "Theodore Ts'o" <tytso@mit.edu>
CC: Darrick J. Wong <djwong@us.ibm.com>
Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
---
 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 |
 						BLOCK_FLAG_DATA_ONLY,
 				       0, rewrite_dir_block, &ctx);
-- 
1.7.4.1


  reply	other threads:[~2012-08-01  7:10 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31  2:53 "Unknown code" error when enabling metadata_csum on ext4 raid1 device Nick Semenkovich
2012-08-01  7:19 ` Zheng Liu [this message]
2012-08-01  7:16   ` Tomasz Chmielewski
2012-08-01  7:48     ` Zheng Liu
2012-08-01  7:51       ` Tomasz Chmielewski
2012-08-01  8:17         ` Zheng Liu
2012-08-02  3:43           ` Nick Semenkovich
2012-08-02  9:58             ` Zheng Liu
2012-08-03  4:01   ` 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=20120801071935.GA12929@gmail.com \
    --to=gnehzuil.liu@gmail.com \
    --cc=djwong@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=mangoo@wpkg.org \
    --cc=semenko@alum.mit.edu \
    --cc=semenko@syndetics.net \
    --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;
as well as URLs for NNTP newsgroup(s).