public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Aneesh Kumar K.V" <aneesh.kumar@linux.vnet.ibm.com>
To: Shen Feng <shen@cn.fujitsu.com>, Mingming Cao <cmm@us.ibm.com>
Cc: alex@clusterfs.com, Andrew Morton <akpm@linux-foundation.org>,
	linux-ext4@vger.kernel.org
Subject: Re: [PATCH] ext4: add error processing when calling ext4_mb_init_cache in mballoc
Date: Wed, 28 May 2008 15:24:20 +0530	[thread overview]
Message-ID: <20080528095420.GD15851@skywalker> (raw)
In-Reply-To: <483D2884.30309@cn.fujitsu.com>

On Wed, May 28, 2008 at 05:40:20PM +0800, Shen Feng wrote:
> Add error processing for ext4_mb_load_buddy when it calls
> ext4_mb_init_cache.
> 
> Signed-off-by: Shen Feng <shen@cn.fujitsu.com>

Reviewed-by: Aneesh Kumar K.V <aneesh.kumar@linux.vnet.ibm.com>

> ---
>  fs/ext4/mballoc.c |   27 ++++++++++++++++++++-------
>  1 files changed, 20 insertions(+), 7 deletions(-)
> 
> diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
> index 35c12db..a30a35d 100644
> --- a/fs/ext4/mballoc.c
> +++ b/fs/ext4/mballoc.c
> @@ -883,6 +883,7 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
>  	int pnum;
>  	int poff;
>  	struct page *page;
> +	int ret;
> 
>  	mb_debug("load group %lu\n", group);
> 
> @@ -914,15 +915,21 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
>  		if (page) {
>  			BUG_ON(page->mapping != inode->i_mapping);
>  			if (!PageUptodate(page)) {
> -				ext4_mb_init_cache(page, NULL);
> +				ret = ext4_mb_init_cache(page, NULL);
> +				if (ret) {
> +					unlock_page(page);
> +					goto err;
> +				}
>  				mb_cmp_bitmaps(e4b, page_address(page) +
>  					       (poff * sb->s_blocksize));
>  			}
>  			unlock_page(page);
>  		}
>  	}
> -	if (page == NULL || !PageUptodate(page))
> +	if (page == NULL || !PageUptodate(page)) {
> +		ret = -EIO;
>  		goto err;
> +	}
>  	e4b->bd_bitmap_page = page;
>  	e4b->bd_bitmap = page_address(page) + (poff * sb->s_blocksize);
>  	mark_page_accessed(page);
> @@ -938,14 +945,20 @@ ext4_mb_load_buddy(struct super_block *sb, ext4_group_t group,
>  		page = find_or_create_page(inode->i_mapping, pnum, GFP_NOFS);
>  		if (page) {
>  			BUG_ON(page->mapping != inode->i_mapping);
> -			if (!PageUptodate(page))
> -				ext4_mb_init_cache(page, e4b->bd_bitmap);
> -
> +			if (!PageUptodate(page)) {
> +				ret = ext4_mb_init_cache(page, e4b->bd_bitmap);
> +				if (ret) {
> +					unlock_page(page);
> +					goto err;
> +				}
> +			}
>  			unlock_page(page);
>  		}
>  	}
> -	if (page == NULL || !PageUptodate(page))
> +	if (page == NULL || !PageUptodate(page)) {
> +		ret = -EIO;
>  		goto err;
> +	}
>  	e4b->bd_buddy_page = page;
>  	e4b->bd_buddy = page_address(page) + (poff * sb->s_blocksize);
>  	mark_page_accessed(page);
> @@ -962,7 +975,7 @@ err:
>  		page_cache_release(e4b->bd_buddy_page);
>  	e4b->bd_buddy = NULL;
>  	e4b->bd_bitmap = NULL;
> -	return -EIO;
> +	return ret;
>  }
> 
>  static void ext4_mb_release_desc(struct ext4_buddy *e4b)
> -- 
> 1.5.4.5
> --
> To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2008-05-28  9:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28  9:40 [PATCH] ext4: add error processing when calling ext4_mb_init_cache in mballoc Shen Feng
2008-05-28  9:54 ` Aneesh Kumar K.V [this message]
2008-05-28 21:09   ` Mingming Cao

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=20080528095420.GD15851@skywalker \
    --to=aneesh.kumar@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=alex@clusterfs.com \
    --cc=cmm@us.ibm.com \
    --cc=linux-ext4@vger.kernel.org \
    --cc=shen@cn.fujitsu.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