linux-btrfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Omar Sandoval <osandov@osandov.com>
To: linux-btrfs@vger.kernel.org
Cc: kernel-team@fb.com
Subject: [PATCH 0/2] btrfs: fix filesystem corruption caused by space cache race
Date: Tue, 16 Aug 2022 16:12:14 -0700	[thread overview]
Message-ID: <cover.1660690698.git.osandov@fb.com> (raw)

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


             reply	other threads:[~2022-08-16 23:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16 23:12 Omar Sandoval [this message]
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
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

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=cover.1660690698.git.osandov@fb.com \
    --to=osandov@osandov.com \
    --cc=kernel-team@fb.com \
    --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;
as well as URLs for NNTP newsgroup(s).