linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kara <jack@suse.cz>
To: shilong wang <wangshilong1991@gmail.com>
Cc: Jan Kara <jack@suse.cz>,
	viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v1 2/2] Ext3: add necessary check in case IO error happens
Date: Mon, 14 Jan 2013 15:17:15 +0100	[thread overview]
Message-ID: <20130114141715.GC6597@quack.suse.cz> (raw)
In-Reply-To: <CAP9B-QnZRbR7rSVuC3_9MtoPVcwLxagnpUrv+pFBKLQUbCXntg@mail.gmail.com>

On Sat 12-01-13 01:22:33, shilong wang wrote:
> From: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> 
> As we know io error may happen when the function 'sb_getblk'
> is called.Add necessary check for it
> 
> The patch also fix a coding style problem.
  Thanks. I've added the patch to my tree.

							Honza

> 
> Signed-off-by: Wang Shilong <wangsl-fnst@cn.fujitsu.com>
> ---
>  fs/ext3/inode.c |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/ext3/inode.c b/fs/ext3/inode.c
> index ff574b4..61bc8bd 100644
> --- a/fs/ext3/inode.c
> +++ b/fs/ext3/inode.c
> @@ -676,6 +676,10 @@ static int ext3_alloc_branch(handle_t *handle,
> struct inode *inode,
>  		 * parent to disk.
>  		 */
>  		bh = sb_getblk(inode->i_sb, new_blocks[n-1]);
> +		if (unlikely(!bh)) {
> +			err = -ENOMEM;
> +			goto failed;
> +		}
>  		branch[n].bh = bh;
>  		lock_buffer(bh);
>  		BUFFER_TRACE(bh, "call get_create_access");
> @@ -717,7 +721,7 @@ failed:
>  		BUFFER_TRACE(branch[i].bh, "call journal_forget");
>  		ext3_journal_forget(handle, branch[i].bh);
>  	}
> -	for (i = 0; i <indirect_blks; i++)
> +	for (i = 0; i < indirect_blks; i++)
>  		ext3_free_blocks(handle, inode, new_blocks[i], 1);
> 
>  	ext3_free_blocks(handle, inode, new_blocks[i], num);
> -- 
> 1.7.7.6
-- 
Jan Kara <jack@suse.cz>
SUSE Labs, CR

      reply	other threads:[~2013-01-14 14:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-12  9:22 [PATCH v1 2/2] Ext3: add necessary check in case IO error happens shilong wang
2013-01-14 14:17 ` Jan Kara [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=20130114141715.GC6597@quack.suse.cz \
    --to=jack@suse.cz \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=wangshilong1991@gmail.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).