All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Josef Bacik <josef@toxicpanda.com>
Cc: linux-btrfs@vger.kernel.org, kernel-team@fb.com
Subject: Re: [PATCH] btrfs: do not call synchronize_srcu() in inode_tree_del
Date: Fri, 22 Nov 2019 19:29:27 +0100	[thread overview]
Message-ID: <20191122182927.GE3001@twin.jikos.cz> (raw)
In-Reply-To: <20191119185935.3079-1-josef@toxicpanda.com>

On Tue, Nov 19, 2019 at 01:59:35PM -0500, Josef Bacik wrote:
> Testing with the new fsstress uncovered a pretty nasty deadlock with
> lookup and snapshot deletion.
> 
> Process A
> unlink
>  -> final iput
>    -> inode_tree_del
>      -> synchronize_srcu(subvol_srcu)
> 
> Process B
> btrfs_lookup  <- srcu_read_lock() acquired here
>   -> btrfs_iget
>     -> find inode that has I_FREEING set
>       -> __wait_on_freeing_inode()
> 
> We're holding the srcu_read_lock() while doing the iget in order to make
> sure our fs root doesn't go away, and then we are waiting for the inode
> to finish freeing.  However because the free'ing process is doing a
> synchronize_srcu() we deadlock.
> 
> Fix this by dropping the synchronize_srcu() in inode_tree_del().  We
> don't need people to stop accessing the fs root at this point, we're
> only adding our empty root to the dead roots list.
> 
> A larger much more invasive fix is forthcoming to address how we deal
> with fs roots, but this fixes the immediate problem.
> 
> Fixes: 76dda93c6ae2 ("Btrfs: add snapshot/subvolume destroy ioctl")
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>

Added to misc-next, thanks.

      reply	other threads:[~2019-11-22 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-19 18:59 [PATCH] btrfs: do not call synchronize_srcu() in inode_tree_del Josef Bacik
2019-11-22 18:29 ` David Sterba [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=20191122182927.GE3001@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=josef@toxicpanda.com \
    --cc=kernel-team@fb.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.