linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] btrfs: fix filesystem corruption caused by space cache race
@ 2022-08-16 23:12 Omar Sandoval
  2022-08-16 23:12 ` [PATCH 1/2] btrfs: fix space cache corruption and potential double allocations Omar Sandoval
                   ` (3 more replies)
  0 siblings, 4 replies; 29+ messages in thread
From: Omar Sandoval @ 2022-08-16 23:12 UTC (permalink / raw)
  To: linux-btrfs; +Cc: kernel-team

From: Omar Sandoval <osandov@fb.com>

Hello,

We recently deployed space_cache v2 on a large set of machines to do
some performance comparisons and found a nasty filesystem corruption bug
that was introduced by the fsync transaction optimization in 5.12. It's
much more likely to affect space_cache=v2 and nospace_cache, but since
space_cache=v1 effectively falls back to nospace_cache if there is a
free space inode generation mismatch, space_cache=v1 could also
theoretically be affected. discard/discard=sync also makes the bug much
easier to hit by making the race window larger.

Patch 1 is the fix itself with a lot more details. Patch 2 is a followup
cleanup.

I'm still working on a reproducer, but I wanted to get this fix out
ASAP.

Thanks!

Omar Sandoval (2):
  btrfs: fix space cache corruption and potential double allocations
  btrfs: get rid of block group caching progress logic

 fs/btrfs/block-group.c     | 49 +++++++++++---------------------------
 fs/btrfs/block-group.h     |  5 +---
 fs/btrfs/extent-tree.c     | 39 +++++++-----------------------
 fs/btrfs/free-space-tree.c |  8 -------
 fs/btrfs/transaction.c     | 41 -------------------------------
 fs/btrfs/zoned.c           |  1 -
 6 files changed, 23 insertions(+), 120 deletions(-)

-- 
2.37.2


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

end of thread, other threads:[~2025-02-23 11:31 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-16 23:12 [PATCH 0/2] btrfs: fix filesystem corruption caused by space cache race Omar Sandoval
2022-08-16 23:12 ` [PATCH 1/2] btrfs: fix space cache corruption and potential double allocations Omar Sandoval
2022-08-17  6:21   ` Andrea Gelmini
2022-08-17 16:53     ` Christoph Anton Mitterer
2022-08-17 23:59       ` Omar Sandoval
2022-08-18  0:22         ` Christoph Anton Mitterer
2022-08-18  0:30           ` Omar Sandoval
2022-08-19  0:16             ` Christoph Anton Mitterer
2022-09-01 16:59               ` Christoph Anton Mitterer
2022-09-01 18:18                 ` Omar Sandoval
2022-09-01 18:52                   ` Holger Hoffstätte
2022-09-01 18:57                     ` Omar Sandoval
2022-09-02 15:43                   ` Christoph Anton Mitterer
2022-09-02 21:25                   ` Christoph Anton Mitterer
2022-08-18  6:21         ` Andrea Gelmini
2022-08-18  6:40           ` Omar Sandoval
2022-08-17  9:47   ` Filipe Manana
2022-08-17 15:32     ` Omar Sandoval
2022-08-17 15:46       ` Filipe Manana
2022-08-22 13:26         ` David Sterba
2022-08-16 23:12 ` [PATCH 2/2] btrfs: get rid of block group caching progress logic Omar Sandoval
2022-08-17  9:47   ` Filipe Manana
2025-02-20 19:26   ` Alex Lyakas
2025-02-20 21:59     ` Omar Sandoval
2025-02-23 11:31       ` Alex Lyakas
2022-08-22 13:36 ` [PATCH 0/2] btrfs: fix filesystem corruption caused by space cache race David Sterba
2022-08-23 17:27 ` David Sterba
2022-08-23 19:20   ` Christoph Anton Mitterer
2022-08-23 20:29     ` David Sterba

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).