linux-ext4.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
To: Ext4 Developers List <linux-ext4@vger.kernel.org>
Cc: "Theodore Ts'o" <tytso@mit.edu>,
	sachin p sant <sachinp@linux.vnet.ibm.com>,
	Ramon <rcvalle@linux.vnet.ibm.com>
Subject: Re: [PATCH] ext4: print more sysadmin-friendly message in check_block_validity()
Date: Tue, 08 Sep 2009 18:49:46 +0530	[thread overview]
Message-ID: <4AA659F2.8010109@linux.vnet.ibm.com> (raw)
In-Reply-To: <1252412562-738-1-git-send-email-tytso@mit.edu>

I have tested this and it's working fine. I am not seeing any kernel 
stack/call traces.

Theodore Ts'o wrote:
> Drop the WARN_ON(1), as he stack trace is not appropriate, since it is
> triggered by file system corruption, and it misleads users into
> thinking there is a kernel bug.  In addition, change the message
> displayed by ext4_error() to make it clear that this is a file system
> corruption problem.
> 
> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Tested-by: Nageswara R Sastry <rnsastry@linux.vnet.ibm.com>
> ---
>  fs/ext4/inode.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
> index 3400961..4d3fd0e 100644
> --- a/fs/ext4/inode.c
> +++ b/fs/ext4/inode.c
> @@ -1121,16 +1121,15 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
>  		ext4_discard_preallocations(inode);
>  }
> 
> -static int check_block_validity(struct inode *inode, sector_t logical,
> -				sector_t phys, int len)
> +static int check_block_validity(struct inode *inode, const char *msg,
> +				sector_t logical, sector_t phys, int len)
>  {
>  	if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) {
> -		ext4_error(inode->i_sb, "check_block_validity",
> +		ext4_error(inode->i_sb, msg,
>  			   "inode #%lu logical block %llu mapped to %llu "
>  			   "(size %d)", inode->i_ino,
>  			   (unsigned long long) logical,
>  			   (unsigned long long) phys, len);
> -		WARN_ON(1);
>  		return -EIO;
>  	}
>  	return 0;
> @@ -1182,8 +1181,8 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
>  	up_read((&EXT4_I(inode)->i_data_sem));
> 
>  	if (retval > 0 && buffer_mapped(bh)) {
> -		int ret = check_block_validity(inode, block,
> -					       bh->b_blocknr, retval);
> +		int ret = check_block_validity(inode, "file system corruption",
> +					       block, bh->b_blocknr, retval);
>  		if (ret != 0)
>  			return ret;
>  	}
> @@ -1264,8 +1263,9 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
> 
>  	up_write((&EXT4_I(inode)->i_data_sem));
>  	if (retval > 0 && buffer_mapped(bh)) {
> -		int ret = check_block_validity(inode, block,
> -					       bh->b_blocknr, retval);
> +		int ret = check_block_validity(inode, "file system "
> +					       "corruption after allocation",
> +					       block, bh->b_blocknr, retval);
>  		if (ret != 0)
>  			return ret;
>  	}



      reply	other threads:[~2009-09-08 13:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <4AA645F0.8050903@linux.vnet.ibm.com>
2009-09-08 12:22 ` [PATCH] ext4: print more sysadmin-friendly message in check_block_validity() Theodore Ts'o
2009-09-08 13:19   ` Nageswara R Sastry [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=4AA659F2.8010109@linux.vnet.ibm.com \
    --to=rnsastry@linux.vnet.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=rcvalle@linux.vnet.ibm.com \
    --cc=sachinp@linux.vnet.ibm.com \
    --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).