Re: [PATCH v1 2/2] Ext3: add necessary check in case IO error happens

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat 12-01-13 01:22:33, shilong wang wrote:
> From: Wang Shilong <wangsl-fnst@xxxxxxxxxxxxxx>
> 
> 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@xxxxxxxxxxxxxx>
> ---
>  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@xxxxxxx>
SUSE Labs, CR
--
To unsubscribe from this list: send the line "unsubscribe linux-fsdevel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Ext4 Filesystem]     [Union Filesystem]     [Filesystem Testing]     [Ceph Users]     [Ecryptfs]     [AutoFS]     [Kernel Newbies]     [Share Photos]     [Security]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux Cachefs]     [Reiser Filesystem]     [Linux RAID]     [Samba]     [Device Mapper]     [CEPH Development]
  Powered by Linux