linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Miao Xie <miaox@cn.fujitsu.com>
To: Josef Bacik <jbacik@fusionio.com>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: remove ourselves from the cluster list under lock
Date: Fri, 23 Aug 2013 15:43:53 +0800	[thread overview]
Message-ID: <521712B9.6050804@cn.fujitsu.com> (raw)
In-Reply-To: <1377205499-14790-1-git-send-email-jbacik@fusionio.com>

On 	thu, 22 Aug 2013 17:04:59 -0400, Josef Bacik wrote:
> A user was reporting weird warnings from btrfs_put_delayed_ref() and I noticed
> that we were doing this list_del_init() on our head ref outside of
> delayed_refs->lock.  This is a problem if we have people still on the list, we
> could end up modifying old pointers and such.  Fix this by removing us from the
> list before we do our run_delayed_ref on our head ref.  Thanks,

Looks good.

Reviewed-by: Miao Xie <miaox@cn.fujitsu.com>

> 
> Signed-off-by: Josef Bacik <jbacik@fusionio.com>
> ---
>  fs/btrfs/extent-tree.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 4c89566..95c6539 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -2440,6 +2440,8 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
>  			default:
>  				WARN_ON(1);
>  			}
> +		} else {
> +			list_del_init(&locked_ref->cluster);
>  		}
>  		spin_unlock(&delayed_refs->lock);
>  
> @@ -2462,7 +2464,6 @@ static noinline int run_clustered_refs(struct btrfs_trans_handle *trans,
>  		 * list before we release it.
>  		 */
>  		if (btrfs_delayed_ref_is_head(ref)) {
> -			list_del_init(&locked_ref->cluster);
>  			btrfs_delayed_ref_unlock(locked_ref);
>  			locked_ref = NULL;
>  		}
> 


      reply	other threads:[~2013-08-23  7:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-22 21:04 [PATCH] Btrfs: remove ourselves from the cluster list under lock Josef Bacik
2013-08-23  7:43 ` Miao Xie [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=521712B9.6050804@cn.fujitsu.com \
    --to=miaox@cn.fujitsu.com \
    --cc=jbacik@fusionio.com \
    --cc=linux-btrfs@vger.kernel.org \
    /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).