All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Jeff Mahoney <jeffm@suse.com>
Cc: linux-btrfs <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH] btrfs: fix lockdep warning with reclaim lock inversion
Date: Wed, 26 Mar 2014 19:19:19 +0100	[thread overview]
Message-ID: <20140326181919.GV29256@twin.jikos.cz> (raw)
In-Reply-To: <5333184E.3090609@suse.com>

On Wed, Mar 26, 2014 at 02:11:26PM -0400, Jeff Mahoney wrote:
> When encountering memory pressure, testers have run into the following
> lockdep warning. It was caused by __link_block_group calling kobject_add
> with the groups_sem held. kobject_add calls kvasprintf with GFP_KERNEL,
> which gets us into reclaim context. The kobject doesn't actually need
> to be added under the lock -- it just needs to ensure that it's only
> added for the first block group to be linked.
> 
> =========================================================
> [ INFO: possible irq lock inversion dependency detected ]
> 3.14.0-rc8-default #1 Not tainted
> ---------------------------------------------------------
> kswapd0/169 just changed the state of lock:
>  (&delayed_node->mutex){+.+.-.}, at: [<ffffffffa018baea>] __btrfs_release_delayed_node+0x3a/0x200 [btrfs]
> but this lock took another, RECLAIM_FS-unsafe lock in the past:
>  (&found->groups_sem){+++++.}
> 
> and interrupts could create inverse lock ordering between them.
> 
> other info that might help us debug this:
>  Possible interrupt unsafe locking scenario:
>        CPU0                    CPU1
>        ----                    ----
>   lock(&found->groups_sem);
>                                local_irq_disable();
>                                lock(&delayed_node->mutex);
>                                lock(&found->groups_sem);
>   <Interrupt>
>     lock(&delayed_node->mutex);
> 
>  *** DEADLOCK ***
> 2 locks held by kswapd0/169:
>  #0:  (shrinker_rwsem){++++..}, at: [<ffffffff81159e8a>] shrink_slab+0x3a/0x160
>  #1:  (&type->s_umount_key#27){++++..}, at: [<ffffffff811bac6f>] grab_super_passive+0x3f/0x90
> 
> Signed-off-by: Jeff Mahoney <jeffm@suse.com>

For the record, fixes https://bugzilla.kernel.org/show_bug.cgi?id=72501

  reply	other threads:[~2014-03-26 18:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-26 18:11 [PATCH] btrfs: fix lockdep warning with reclaim lock inversion Jeff Mahoney
2014-03-26 18:19 ` David Sterba [this message]
2014-04-09 16:05 ` Filipe David Manana
2014-04-09 21:22   ` Jeff Mahoney
2014-04-09 21:23 Jeff Mahoney
2014-04-14 16:55 ` David Sterba

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=20140326181919.GV29256@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=jeffm@suse.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 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.