From: Greg KH <gregkh@linuxfoundation.org>
To: ethanwu <ethanwu@synology.com>
Cc: stable@vger.kernel.org, dsterba@suse.com
Subject: Re: [PATCH] btrfs: Take trans lock before access running trans in check_delayed_ref
Date: Thu, 17 May 2018 11:37:36 +0200 [thread overview]
Message-ID: <20180517093736.GA10421@kroah.com> (raw)
In-Reply-To: <1526547911-32169-1-git-send-email-ethanwu@synology.com>
On Thu, May 17, 2018 at 05:01:45PM +0800, ethanwu wrote:
> commit 998ac6d21cfd6efd58f5edf420bae8839dda9f2a upstream
>
> In preivous patch:
> Btrfs: kill trans in run_delalloc_nocow and btrfs_cross_ref_exist
> We avoid starting btrfs transaction and get this information from
> fs_info->running_transaction directly.
>
> When accessing running_transaction in check_delayed_ref, there's a
> chance that current transaction will be freed by commit transaction
> after the NULL pointer check of running_transaction is passed.
>
> After looking all the other places using fs_info->running_transaction,
> they are either protected by trans_lock or holding the transactions.
>
> Fix this by using trans_lock and increasing the use_count.
>
> Fixes: e4c3b2dcd144 ("Btrfs: kill trans in run_delalloc_nocow and btrfs_cross_ref_exist")
> CC: stable@vger.kernel.org # 4.14+
> Signed-off-by: ethanwu <ethanwu@synology.com>
> Signed-off-by: David Sterba <dsterba@suse.com>
> ---
> fs/btrfs/extent-tree.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Thanks for the backport, now queued up.
greg k-h
prev parent reply other threads:[~2018-05-17 9:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-06 0:35 FAILED: patch "[PATCH] btrfs: Take trans lock before access running trans in" failed to apply to 4.14-stable tree gregkh
2018-05-17 9:01 ` [PATCH] btrfs: Take trans lock before access running trans in check_delayed_ref ethanwu
2018-05-17 9:37 ` Greg KH [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=20180517093736.GA10421@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=dsterba@suse.com \
--cc=ethanwu@synology.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).