From: Zheng Liu <gnehzuil.liu@gmail.com>
To: Theodore Ts'o <tytso@mit.edu>
Cc: linux-ext4@vger.kernel.org, Zheng Liu <wenqing.lz@taobao.com>
Subject: Re: [PATCH] ext4: add WARN_ON to check the length of allocated blocks
Date: Mon, 25 Mar 2013 10:50:23 +0800 [thread overview]
Message-ID: <20130325025023.GA14550@gmail.com> (raw)
In-Reply-To: <20130324182318.GA26792@thunk.org>
On Sun, Mar 24, 2013 at 02:23:18PM -0400, Theodore Ts'o wrote:
> On Sun, Mar 24, 2013 at 05:42:53PM +0800, Zheng Liu wrote:
> > From: Zheng Liu <wenqing.lz@taobao.com>
> >
> > In this commit (921f266b) a sanity check is added in map_blocks to make
> > sure 'retval == map->m_len'. But we need to define a macro to enable
> > it. This commit uses a WARN_ON to do the same thing.
> >
> > Signed-off-by: Zheng Liu <wenqing.lz@taobao.com>
>
> You and Dmitry were the ones who using originally these these checks
> to fix the bugs here;
Yes, I use this check to fix bug.
> if we think the code is clean enough that we
> don't need the debugging information with the inode number, length,
> etc., then sure, we could use the unconditionally defined WARN_ON().
>
> If we wanted to be really paranoid and give ourselves the maximal
> amount of debugging information, we could of course do something like
> this:
>
> if (retval != map->m_len) {
> ext4_warning(inode->i_sb, "ES len assertation failed for inode: %lu retval %d != map->m_len %d\n", inode->i_ino, retval,
> map->m_len);
> WARN_ON(1);
> }
I think this is better.
>
> This way, we get the stack dump, the file system device, and all of
> the debugging information. The tradeoff is we're bloating the code
> size a bit.
>
> The question is really how confident are we that we've found all of
> the potential bugs here. If we think that there's a chance we might
> trip this check in the future, sometimes it's good to print as much
> information as possible, especially if it's hard to create a
> reproduction on demand.
>
> What do you think?
In my sand box, after fixed the bug, I never see this warning again.
But I do believe we'd better leave it here to give us an opportunity to
fix some potential bugs.
Thanks,
- Zheng
prev parent reply other threads:[~2013-03-25 2:34 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-03-24 9:42 [PATCH] ext4: add WARN_ON to check the length of allocated blocks Zheng Liu
2013-03-24 18:23 ` Theodore Ts'o
2013-03-25 2:50 ` Zheng Liu [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=20130325025023.GA14550@gmail.com \
--to=gnehzuil.liu@gmail.com \
--cc=linux-ext4@vger.kernel.org \
--cc=tytso@mit.edu \
--cc=wenqing.lz@taobao.com \
/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).