Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Sweet Tea Dorminy <sweettea-kernel@dorminy.me>
To: fdmanana@kernel.org, linux-btrfs@vger.kernel.org
Subject: Re: [PATCH 1/2] btrfs: fix data races when accessing the reserved amount of block reserves
Date: Mon, 26 Feb 2024 12:39:35 -0500	[thread overview]
Message-ID: <cf24775e-a9da-498e-93c6-8a2c8009f53a@dorminy.me> (raw)
In-Reply-To: <5ff1a68f4289d5bb870a499b248d329893d417ae.1708429856.git.fdmanana@suse.com>


> So add a helper to get the reserved amount of a block reserve while
> holding the lock. The value may be not be up to date anymore when used by
> need_preemptive_reclaim() and btrfs_preempt_reclaim_metadata_space(), but
> that's ok since the worst it can do is cause more reclaim work do be done
> sooner rather than later. Reading the field while holding the lock instead
> of using the data_race() annotation is used in order to prevent load
> tearing.

Would READ_ONCE() be enough? My understanding is that it should be 
enough against load tearing if it's aligned, and I think both size and 
reserved are aligned? But I'm always learning more about how to do 
things right.

  reply	other threads:[~2024-02-26 17:39 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-20 12:24 [PATCH 0/2] btrfs: fix a couple KCSAN warnings fdmanana
2024-02-20 12:24 ` [PATCH 1/2] btrfs: fix data races when accessing the reserved amount of block reserves fdmanana
2024-02-26 17:39   ` Sweet Tea Dorminy [this message]
2024-02-26 17:55     ` Filipe Manana
2024-02-20 12:24 ` [PATCH 2/2] btrfs: fix data race at btrfs_use_block_rsv() when accessing block reserve fdmanana
2024-02-21 11:12 ` [PATCH 0/2] btrfs: fix a couple KCSAN warnings David Sterba
2024-02-21 11:25   ` Filipe Manana
2024-02-21 11:31     ` 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=cf24775e-a9da-498e-93c6-8a2c8009f53a@dorminy.me \
    --to=sweettea-kernel@dorminy.me \
    --cc=fdmanana@kernel.org \
    --cc=linux-btrfs@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