public inbox for linux-btrfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Fix data race with transaction->state
@ 2025-11-18 15:59 Josef Bacik
  2025-11-18 15:59 ` [PATCH 1/2] btrfs: fix data race on transaction->state Josef Bacik
  2025-11-18 15:59 ` [PATCH 2/2] btrfs: remove useless smp_mb in start_transaction Josef Bacik
  0 siblings, 2 replies; 4+ messages in thread
From: Josef Bacik @ 2025-11-18 15:59 UTC (permalink / raw)
  To: linux-btrfs

I've been setting up Claude to setup fstests and run vms automatically and I
kept hitting hangs. This turned out to be a bug with qemu's microvm, but at some
point I was convinced there was a deadlock with running out of block tags and
ordered extent completion and transaction commit. This actually wasn't the case,
however this data race is in fact real. We can easily miss wakeups if we have to
wait on transaction state to change because we do it outside of a lock and we do
not have proper barriers around transaction->state. I suspect this explains the
random hangs that I would see in production while at Meta that would clear up
eventually (we do call wakeup on the transaction wait thing a lot). In any case
this is a data race, even if it wasn't my particular bug, we should fix it.
I've run it through fstests a few times, but obviously spot check it since I'm a
little rusty with this stuff at the moment. Thanks,

Josef

Josef Bacik (2):
  btrfs: fix data race on transaction->state
  btrfs: remove useless smp_mb in start_transaction

 fs/btrfs/disk-io.c     |  8 ++++----
 fs/btrfs/qgroup.c      |  2 +-
 fs/btrfs/transaction.c | 29 +++++++++++++++--------------
 fs/btrfs/volumes.c     |  3 ++-
 4 files changed, 22 insertions(+), 20 deletions(-)

-- 
2.51.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-19 12:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-18 15:59 [PATCH 0/2] Fix data race with transaction->state Josef Bacik
2025-11-18 15:59 ` [PATCH 1/2] btrfs: fix data race on transaction->state Josef Bacik
2025-11-19 12:36   ` David Sterba
2025-11-18 15:59 ` [PATCH 2/2] btrfs: remove useless smp_mb in start_transaction Josef Bacik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox