Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: David Sterba <dsterba@suse.cz>
To: Qu Wenruo <quwenruo.btrfs@gmx.com>
Cc: Johannes Thumshirn <Johannes.Thumshirn@wdc.com>,
	Qu Wenruo <wqu@suse.com>,
	"linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Re: [PATCH 1/2] btrfs: fix wild pointer access during metadata read failure for subpage
Date: Mon, 15 Mar 2021 19:51:09 +0100	[thread overview]
Message-ID: <20210315185108.GA7604@twin.jikos.cz> (raw)
In-Reply-To: <f4ebad22-2004-b051-2871-8f1ed64cc6cc@gmx.com>

On Mon, Mar 15, 2021 at 04:25:32PM +0800, Qu Wenruo wrote:
> 
> 
> On 2021/3/15 下午3:55, Johannes Thumshirn wrote:
> > On 15/03/2021 06:40, Qu Wenruo wrote:
> >> The difference against find_extent_buffer_nospinlock() is:
> >> - Also handles regular sectorsize == PAGE_SIZE case
> >> - No extent buffer refs increase/decrease
> >>    As extent buffer under IO must has non-zero refs.
> >
> > Can these be merged into a single function? The sectorsie == PAGE_SIZE case
> > won't do anything for find_extent_buffer_nospinlock() and the
> > atomic_inc_not_zero(&eb->refs) can be hidden behind a 'if (write)' check.
> 
> That would make the eb refs change too inconsistent.
> 
> But I get your point.
> 
> How about calling find_extent_buffer_nospinlock() and then dec the refs
> manually?

Is this equivalent to this patch? Ie. the atomic_inc_not_zero in
find_extent_buffer_nospinlock happens inside the RCU section, while what
you suggest looks like

find_extent_buffer_nospinlock()
  rcu_lock
  radix_lookup
  rcu_unlock
atomic_inc_not_zero()

  reply	other threads:[~2021-03-15 18:53 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-15  5:39 [PATCH 0/2] btrfs: fixes for subpage which also affect read-only mount Qu Wenruo
2021-03-15  5:39 ` [PATCH 1/2] btrfs: fix wild pointer access during metadata read failure for subpage Qu Wenruo
2021-03-15  7:55   ` Johannes Thumshirn
2021-03-15  8:25     ` Qu Wenruo
2021-03-15 18:51       ` David Sterba [this message]
2021-03-16  0:03         ` Qu Wenruo
2021-03-15  5:39 ` [PATCH 2/2] btrfs: make reada to be subpage compatible Qu Wenruo
2021-03-15  9:39   ` Johannes Thumshirn
2021-03-15 15:42 ` [PATCH 0/2] btrfs: fixes for subpage which also affect read-only mount David Sterba
2021-03-16  0:29   ` Qu Wenruo
2021-03-16 10:08     ` David Sterba
2021-03-16 10:15 ` David Sterba

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=20210315185108.GA7604@twin.jikos.cz \
    --to=dsterba@suse.cz \
    --cc=Johannes.Thumshirn@wdc.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=quwenruo.btrfs@gmx.com \
    --cc=wqu@suse.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