Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Johannes Thumshirn <johannes.thumshirn@wdc.com>
To: David Sterba <dsterba@suse.cz>
Cc: linux-btrfs@vger.kernel.org, Naohiro Aota <naohiro.aota@wdc.com>,
	 David Sterba <dsterba@suse.com>, Qu Wenruo <wqu@suse.com>
Subject: Re: [PATCH 4/4] btrfs: zoned: avoid underflow of bytes_zone_unusable
Date: Fri, 2 Oct 2026 09:32:04 +0200	[thread overview]
Message-ID: <ar9dTrpxbbJ2ha9D@mayhem.fritz.box> (raw)
In-Reply-To: <20260914150811.GJ54722@twin.jikos.cz>

On Mon, Sep 14, 2026 at 05:08:11PM +0200, David Sterba wrote:
> On Mon, Sep 14, 2026 at 10:52:48AM +0200, Johannes Thumshirn wrote:
> > The two functions btrfs_free_reserved_bytes() and
> > btrfs_reset_unused_block_groups() both manipulate
> > space_info->bytes_zone_unusable without using the accessor function
> > btrfs_space_info_update_bytes_zone_unusable() potentially risking an
> > underflow (in case of btrfs_reset_unused_block_groups()).
> > 
> > Use btrfs_space_info_update_bytes_zone_unusable() in both function, in
> > the case of btrfs_free_reserved_bytes() it is mostly for documenting
> > purposes.
> > 
> > Signed-off-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
> 
> The two cases cover all modifications of the bytes_zone_unusable, it
> could make sense to force using that wrapper, eg. renaming the
> identifier and providing only a get/set helpers.

I have a local version of this, but I don't really like it, sorry. It's a lot
of churn.

      reply	other threads:[~2026-10-02  7:32 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-14  8:52 [PATCH 0/4] btrfs: zoned: LLM inspired fixes Johannes Thumshirn
2026-09-14  8:52 ` [PATCH 1/4] btrfs: zoned: only change active zone counter on successful (de)activation Johannes Thumshirn
2026-09-14  8:52 ` [PATCH 2/4] btrfs: zoned: fix possible UAF in wait_eb_writebacks Johannes Thumshirn
2026-09-14 15:05   ` David Sterba
2026-10-02  7:32     ` Johannes Thumshirn
2026-09-14  8:52 ` [PATCH 3/4] btrfs: zoned: requeue block group if zone reset bails out Johannes Thumshirn
2026-09-14  8:52 ` [PATCH 4/4] btrfs: zoned: avoid underflow of bytes_zone_unusable Johannes Thumshirn
2026-09-14 15:08   ` David Sterba
2026-10-02  7:32     ` Johannes Thumshirn [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=ar9dTrpxbbJ2ha9D@mayhem.fritz.box \
    --to=johannes.thumshirn@wdc.com \
    --cc=dsterba@suse.com \
    --cc=dsterba@suse.cz \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=naohiro.aota@wdc.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