From: Josef Bacik <josef@redhat.com>
To: Stefan Behrens <sbehrens@giantdisaster.de>
Cc: linux-btrfs@vger.kernel.org
Subject: Re: [PATCH] Btrfs: swap order of two spinlocks (lockdep complains)
Date: Tue, 24 Apr 2012 11:19:18 -0400 [thread overview]
Message-ID: <20120424151918.GA3326@localhost.localdomain> (raw)
In-Reply-To: <1335276129-2059-1-git-send-email-sbehrens@giantdisaster.de>
On Tue, Apr 24, 2012 at 04:02:09PM +0200, Stefan Behrens wrote:
> may_commit_transaction() calls
> spin_lock(&space_info->lock);
> spin_lock(&delayed_rsv->lock);
> and update_global_block_rsv() calls
> spin_lock(&block_rsv->lock);
> spin_lock(&sinfo->lock);
>
> Lockdep complains about this at run time.
> Everywhere except in update_global_block_rsv(), the space_info lock is
> the outer lock, therefore the locking order in update_global_block_rsv()
> is changed.
>
> Signed-off-by: Stefan Behrens <sbehrens@giantdisaster.de>
> ---
> fs/btrfs/extent-tree.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 84497f8..6fc2e6f 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -4214,8 +4214,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info)
>
> num_bytes = calc_global_metadata_size(fs_info);
>
> - spin_lock(&block_rsv->lock);
> spin_lock(&sinfo->lock);
> + spin_lock(&block_rsv->lock);
>
> block_rsv->size = num_bytes;
>
> @@ -4241,8 +4241,8 @@ static void update_global_block_rsv(struct btrfs_fs_info *fs_info)
> block_rsv->full = 1;
> }
>
> - spin_unlock(&sinfo->lock);
> spin_unlock(&block_rsv->lock);
> + spin_unlock(&sinfo->lock);
> }
>
> static void init_global_block_rsv(struct btrfs_fs_info *fs_info)
> --
> 1.7.10
>
Reviewed-by: Josef Bacik <josef@redhat.com>
Thanks,
Josef
prev parent reply other threads:[~2012-04-24 15:19 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-04-24 14:02 [PATCH] Btrfs: swap order of two spinlocks (lockdep complains) Stefan Behrens
2012-04-24 15:19 ` Josef Bacik [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=20120424151918.GA3326@localhost.localdomain \
--to=josef@redhat.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=sbehrens@giantdisaster.de \
/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).