stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: gregkh@linuxfoundation.org
Cc: josef@toxicpanda.com, dsterba@suse.com, stable@vger.kernel.org
Subject: Re: FAILED: patch "[PATCH] btrfs: do not call synchronize_srcu() in inode_tree_del" failed to apply to 4.9-stable tree
Date: Mon, 23 Dec 2019 16:28:13 -0500	[thread overview]
Message-ID: <20191223212812.GZ17708@sasha-vm> (raw)
In-Reply-To: <1577121107178231@kroah.com>

On Mon, Dec 23, 2019 at 12:11:47PM -0500, gregkh@linuxfoundation.org wrote:
>
>The patch below does not apply to the 4.9-stable tree.
>If someone wants it applied there, or to any other stable or longterm
>tree, then please email the backport, including the original git commit
>id to <stable@vger.kernel.org>.
>
>thanks,
>
>greg k-h
>
>------------------ original commit in Linus's tree ------------------
>
>From f72ff01df9cf5db25c76674cac16605992d15467 Mon Sep 17 00:00:00 2001
>From: Josef Bacik <josef@toxicpanda.com>
>Date: Tue, 19 Nov 2019 13:59:35 -0500
>Subject: [PATCH] btrfs: do not call synchronize_srcu() in inode_tree_del
>
>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")
>CC: stable@vger.kernel.org # 4.4+
>Signed-off-by: Josef Bacik <josef@toxicpanda.com>
>Reviewed-by: David Sterba <dsterba@suse.com>
>Signed-off-by: David Sterba <dsterba@suse.com>

Fixed up to work around missing 0b246afa62b0 ("btrfs: root->fs_info
cleanup, add fs_info convenience variables") and queued for 4.9 and 4.4.

-- 
Thanks,
Sasha

      reply	other threads:[~2019-12-23 21:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-23 17:11 FAILED: patch "[PATCH] btrfs: do not call synchronize_srcu() in inode_tree_del" failed to apply to 4.9-stable tree gregkh
2019-12-23 21:28 ` Sasha Levin [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=20191223212812.GZ17708@sasha-vm \
    --to=sashal@kernel.org \
    --cc=dsterba@suse.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=josef@toxicpanda.com \
    --cc=stable@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).