All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Yan Zheng <zheng.yan@oracle.com>
Cc: linux-btrfs@vger.kernel.org, Chris Mason <chris.mason@oracle.com>
Subject: Re: [PATCH] Fix balance Oops
Date: Fri, 7 Aug 2009 08:50:39 +0200	[thread overview]
Message-ID: <20090807065039.GR12579@kernel.dk> (raw)
In-Reply-To: <4A7BC631.3040106@oracle.com>

On Fri, Aug 07 2009, Yan Zheng wrote:
> invalidate_inode_pages2_range may return -EBUSY occasionally
> which results Oops. This patch fixes the issue by moving
> invalidate_inode_pages2_range into a loop and keeping calling
> it until the return value is not -EBUSY.
> 
> Signed-off-by: Yan Zheng <zheng.yan@oracle.com>
> 
> ---
> diff -urp 1/fs/btrfs/relocation.c 2/fs/btrfs/relocation.c
> --- 1/fs/btrfs/relocation.c	2009-07-29 10:03:04.367858774 +0800
> +++ 2/fs/btrfs/relocation.c	2009-08-07 13:26:43.882147138 +0800
> @@ -2553,8 +2553,13 @@ int relocate_inode_pages(struct inode *i
>  	last_index = (start + len - 1) >> PAGE_CACHE_SHIFT;
>  
>  	/* make sure the dirty trick played by the caller work */
> -	ret = invalidate_inode_pages2_range(inode->i_mapping,
> -					    first_index, last_index);
> +	while (1) {
> +		ret = invalidate_inode_pages2_range(inode->i_mapping,
> +						    first_index, last_index);
> +		if (ret != -EBUSY)
> +			break;
> +		cond_resched();
> +	}

If it returns EBUSY, would it not make more sense to call
filemap_write_and_wait_range() instead of hammering on invalidate?

-- 
Jens Axboe


  reply	other threads:[~2009-08-07  6:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-08-07  6:14 [PATCH] Fix balance Oops Yan Zheng
2009-08-07  6:50 ` Jens Axboe [this message]
2009-08-07  7:16   ` Yan Zheng
2009-08-07  7:19     ` Jens Axboe
2009-08-07  9:07       ` Yan Zheng
2009-08-07 12:51         ` Chris Mason

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=20090807065039.GR12579@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=chris.mason@oracle.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=zheng.yan@oracle.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.