From: David Sterba <dsterba@suse.cz>
To: Filipe Manana <fdmanana@kernel.org>
Cc: Stefan Roesch <shr@fb.com>,
kernel-team@fb.com, io-uring@vger.kernel.org,
linux-btrfs@vger.kernel.org, linux-mm@kvack.org, axboe@kernel.dk,
josef@toxicpanda.com, fdmanana@gmail.com
Subject: Re: [PATCH v3 02/12] btrfs: implement a nowait option for tree searches
Date: Mon, 26 Sep 2022 12:55:46 +0200 [thread overview]
Message-ID: <20220926105546.GS32411@twin.jikos.cz> (raw)
In-Reply-To: <20220926091440.GA1198392@falcondesktop>
On Mon, Sep 26, 2022 at 10:14:40AM +0100, Filipe Manana wrote:
> On Mon, Sep 12, 2022 at 12:27:42PM -0700, Stefan Roesch wrote:
> > From: Josef Bacik <josef@toxicpanda.com>
> > +{
> > + struct extent_buffer *eb;
> > +
> > + while (1) {
> > + eb = btrfs_root_node(root);
> > + if (!btrfs_try_tree_read_lock(eb))
> > + return ERR_PTR(-EAGAIN);
>
> There's a leak of the extent buffer here.
> This fixes it up:
>
> diff --git a/fs/btrfs/locking.c b/fs/btrfs/locking.c
> index 9d53bcfb6d9b..0eab3cb274a1 100644
> --- a/fs/btrfs/locking.c
> +++ b/fs/btrfs/locking.c
> @@ -298,8 +298,10 @@ struct extent_buffer *btrfs_try_read_lock_root_node(struct btrfs_root *root)
>
> while (1) {
> eb = btrfs_root_node(root);
> - if (!btrfs_try_tree_read_lock(eb))
> + if (!btrfs_try_tree_read_lock(eb)) {
> + free_extent_buffer(eb);
> return ERR_PTR(-EAGAIN);
> + }
> if (eb == root->node)
> break;
> btrfs_tree_read_unlock(eb);
Folded to the commit, thanks.
next prev parent reply other threads:[~2022-09-26 11:01 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-12 19:27 [PATCH v3 00/12] io-uring/btrfs: support async buffered writes Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 01/12] mm: export balance_dirty_pages_ratelimited_flags() Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 02/12] btrfs: implement a nowait option for tree searches Stefan Roesch
2022-09-26 9:14 ` Filipe Manana
2022-09-26 10:55 ` David Sterba [this message]
2022-09-12 19:27 ` [PATCH v3 03/12] btrfs: make can_nocow_extent nowait compatible Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 04/12] btrfs: add the ability to use NO_FLUSH for data reservations Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 05/12] btrfs: add btrfs_try_lock_ordered_range Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 06/12] btrfs: make btrfs_check_nocow_lock nowait compatible Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 07/12] btrfs: make prepare_pages " Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 08/12] btrfs: make lock_and_cleanup_extent_if_need " Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 09/12] btrfs: plumb NOWAIT through the write path Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 10/12] btrfs: make balance_dirty_pages nowait compatible Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 11/12] btrfs: assert nowait mode is not used for some btree search functions Stefan Roesch
2022-09-12 19:27 ` [PATCH v3 12/12] btrfs: enable nowait async buffered writes Stefan Roesch
2022-09-13 9:47 ` [PATCH v3 00/12] io-uring/btrfs: support " Filipe Manana
2022-09-20 12:25 ` David Sterba
2022-09-21 10:19 ` David Sterba
2022-09-21 14:33 ` Jens Axboe
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=20220926105546.GS32411@twin.jikos.cz \
--to=dsterba@suse.cz \
--cc=axboe@kernel.dk \
--cc=fdmanana@gmail.com \
--cc=fdmanana@kernel.org \
--cc=io-uring@vger.kernel.org \
--cc=josef@toxicpanda.com \
--cc=kernel-team@fb.com \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=shr@fb.com \
/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