Linux Btrfs filesystem development
 help / color / mirror / Atom feed
From: Sun YangKai <sunk67188@gmail.com>
To: "linux-btrfs@vger.kernel.org" <linux-btrfs@vger.kernel.org>
Subject: Opt-in non-fatal data csum mismatch handling?
Date: Sat, 16 May 2026 15:16:43 +0800	[thread overview]
Message-ID: <eb259b63-e19e-4bc9-9741-161faa15fb55@gmail.com> (raw)

Hi btrfs developers and maintainers,

Many btrfs deployments run on consumer hardware — desktop PCs, home NAS 
boxes, laptops with no ECC RAM, USB-attached drives, consumer SSDs — 
environments where occasional data corruption are not rare. For many of 
these users, the data that fills most of the volume is also the data 
they care least about per-byte: BitTorrent downloads, build caches, 
browser caches, transcoded media, and so on. They would prefer "warn me 
and give me the data" over "fail the read with -EIO".

Today btrfs offers two ways out: `nodatasum` (and the `chattr +C` 
linkage) and `rescue=ignoredatacsums`. Both disable detection entirely, 
losing the diagnostic signal users might still want. The middle option — 
keep verifying, keep logging, but let the read succeed on mismatch — 
isn't available short of patching the kernel.

A possible interface: a mount option (e.g. `datacsum_action=warn`) that 
preserves the existing diagnostics — `btrfs_print_data_csum_error()` and 
the `BTRFS_DEV_STAT_CORRUPTION_ERRS` counter — but, after all 
mirror-repair attempts have failed, returns the corrupted data to the 
caller instead of `-EIO`. Disk-layer EIO from below the csum check would 
continue to propagate unchanged.

Before sketching a patch I wanted to ask:

1. Is the concept acceptable in principle, or is "never silently return 
corrupt data" a hard line for btrfs?
2. If acceptable, is "suppress csum-fail only, never disk EIO" the right 
boundary?
3. Are the existing diagnostic anchors (dev_stat counter + ratelimited 
dmesg) sufficient for the "warn" half, or would you want a statx/xattr 
surface as well?

Happy to send an RFC patch if the direction sounds reasonable.

Thanks,
Sun YangKai

                 reply	other threads:[~2026-05-16  7:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=eb259b63-e19e-4bc9-9741-161faa15fb55@gmail.com \
    --to=sunk67188@gmail.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