All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Olof Johansson <olof@lixom.net>
Cc: dsterba@suse.de, linux-btrfs@vger.kernel.org, clm@fb.com,
	linux-kernel@vger.kernel.org
Subject: Re: Circular lock dep in btrfs triggered by shrinker
Date: Mon, 22 Oct 2018 20:22:43 +0200	[thread overview]
Message-ID: <20181022182243.GM16290@twin.jikos.cz> (raw)
In-Reply-To: <20181022100726.5hwvc5xswg3k3a2f@localhost>

On Mon, Oct 22, 2018 at 03:07:26AM -0700, Olof Johansson wrote:
> I hit the below circular locking dependency. Seems like the assumption made in
> 712e36c5f2a7fa56 ("btrfs: use GFP_KERNEL in btrfs_alloc_inode") either isn't
> true, or has since changed?

I think it must have been there from the beginning. There were reports
of this lockdep warning like the below and IIRC a few more
(https://lkml.kernel.org/r/20180627120523.GA2287@suse.cz), but without a
resolution.

Incidentally, there was a fix that's now in the 4.20 pull and only after
I had seen your report I realized that it was the fix for the warning:

https://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux.git/commit/?h=for-4.20-part1&id=84de76a2fb217dc1b6bc2965cc397d1648aa1404

It disables the filesystem allocations using the memalloc_nofs mechanism
around free space inode allocation, while my original patch expected
only regular inodes created by VFS.

> ======================================================
> WARNING: possible circular locking dependency detected
> 4.19.0 #25 Not tainted
> ------------------------------------------------------
> kswapd0/414 is trying to acquire lock:
> 000000008b8f1971 (&delayed_node->mutex){+.+.}, at: __btrfs_release_delayed_node+0x35/0x1e0
> but task is already holding lock:
> 00000000032f657e (fs_reclaim){+.+.}, at: __fs_reclaim_acquire+0x0/0x30
> which lock already depends on the new lock.
> 
> the existing dependency chain (in reverse order) is:
> -> #3 (fs_reclaim){+.+.}:
>        kmem_cache_alloc+0x24/0x270
>        btrfs_alloc_inode+0x1f/0x260
>        alloc_inode+0x13/0x80
>        iget5_locked+0x3f/0x80
>        btrfs_iget+0x52/0x680
>        __lookup_free_space_inode+0xd9/0x110

The patch adds memalloc_nofs into ^^^^.  It's scheduled for stable so
the warning will disappear eventually, thanks for the report.

  reply	other threads:[~2018-10-22 18:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-22 10:07 Circular lock dep in btrfs triggered by shrinker Olof Johansson
2018-10-22 18:22 ` David Sterba [this message]
2018-10-23  7:53   ` Michal Hocko
2018-10-23  8:41   ` Olof Johansson

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=20181022182243.GM16290@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=clm@fb.com \
    --cc=dsterba@suse.de \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olof@lixom.net \
    /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.