linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Guo Chao <yan@linux.vnet.ibm.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: tytso@mit.edu, linux-ext4@vger.kernel.org
Subject: Re: [PATCH 1/3] ext4: report error if things go wrong when do checksum
Date: Sun, 6 Jan 2013 10:37:14 +0800	[thread overview]
Message-ID: <20130106023713.GA5497@yanx> (raw)
In-Reply-To: <20130105195054.GL20106@blackbox.djwong.org>


Hello, Darrick,

On Sat, Jan 05, 2013 at 11:50:54AM -0800, Darrick J. Wong wrote:
> On Sat, Jan 05, 2013 at 03:42:59PM +0800, Guo Chao wrote:
> > In ext4_dx_csum_verify(), if we detect corrupted data,
> > we do not compare checksum because checksum itself may
> > be wrong, but we should report error in this case.
> > 
> > Cc: Darrick J. Wong <darrick.wong@oracle.com>
> > Signed-off-by: Guo Chao <yan@linux.vnet.ibm.com>
> > ---
> >  fs/ext4/namei.c |    4 ++--
> >  1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c
> > index cac4482..843e29f 100644
> > --- a/fs/ext4/namei.c
> > +++ b/fs/ext4/namei.c
> > @@ -370,14 +370,14 @@ static int ext4_dx_csum_verify(struct inode *inode,
> >  	c = get_dx_countlimit(inode, dirent, &count_offset);
> >  	if (!c) {
> >  		EXT4_ERROR_INODE(inode, "dir seems corrupt?  Run e2fsck -D.");
> > -		return 1;
> > +		return 0;
> >  	}
> >  	limit = le16_to_cpu(c->limit);
> >  	count = le16_to_cpu(c->count);
> >  	if (count_offset + (limit * sizeof(struct dx_entry)) >
> >  	    EXT4_BLOCK_SIZE(inode->i_sb) - sizeof(struct dx_tail)) {
> >  		warn_no_space_for_csum(inode);
> > -		return 1;
> > +		return 0;
> 
> In both of these cases we cannot figure out where the dx block checksum lives,
> and therefore we have no stored checksum to compare against.  This can result
> from enabling checksums on a existing filesystem and ignoring tune2fs' request
> to run fsck -D to rebuild dx blocks that are completely full.  However, since
> we haven't a checksum that we could use to decide if there's real corruption,
> there's no cause to return -EIO to the user.  Therefore, we print a warning and
> trust the sanity checks to catch totally bogus blocks, which is the best we can
> hope for.
> 
> Sorry, but this doesn't seem necessary.

Thanks for the explaination. 

I think ext4_dirent_csum_verify() can encounter similar problem but return
error. But I'm not sure it's the same case.

Thanks,
Guo Chao

> --D
> >  	}
> >  	t = (struct dx_tail *)(((struct dx_entry *)c) + limit);
> >  
> > -- 
> > 1.7.9.5
> > 


      reply	other threads:[~2013-01-06  2:37 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-05  7:42 [PATCH 1/3] ext4: report error if things go wrong when do checksum Guo Chao
2013-01-05  7:43 ` [PATCH 2/3] ext4: release buffer in failed path in dx_probe() Guo Chao
2013-01-05 19:41   ` Darrick J. Wong
2013-01-07  4:24     ` Theodore Ts'o
2013-01-05  7:43 ` [PATCH 3/3] ext4: remove duplicate assignment in ext4_init_new_dir() Guo Chao
2013-01-05  8:05   ` Tao Ma
2013-01-07  4:37   ` Theodore Ts'o
2013-01-05 19:50 ` [PATCH 1/3] ext4: report error if things go wrong when do checksum Darrick J. Wong
2013-01-06  2:37   ` Guo Chao [this message]

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=20130106023713.GA5497@yanx \
    --to=yan@linux.vnet.ibm.com \
    --cc=darrick.wong@oracle.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;
as well as URLs for NNTP newsgroup(s).