mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Qu Wenruo <wqu@suse.com>
To: Cheng Yongkang <teel4res@gmail.com>, David Sterba <dsterba@suse.com>
Cc: Chris Mason <mason@kernel.org>,
	linux-btrfs@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] btrfs: return an error for unrepaired RAID56 scrub sectors
Date: Mon, 26 Oct 2026 17:22:28 +1030	[thread overview]
Message-ID: <96b705a1-81ad-4e89-af71-a27d009333b8@suse.com> (raw)
In-Reply-To: <20261025180304.349254-1-teel4res@gmail.com>



在 2026/10/26 04:33, Cheng Yongkang 写道:
> scrub_raid56_parity_stripe() returns the leftover value of
> scrub_find_fill_first_stripe() (0 or 1) when it detects unrepaired
> sectors in a data stripe.  Scrub callers only treat negative values as
> errors, so the unrepaired state is masked as success and P/Q
> regeneration is skipped; a device replace can then copy corrupted data.
> 
> Return -EIO so the unrepaired sectors are reported and the corrupt
> stripe is not treated as healthy.
> 
> The masked-success behavior was reproduced 3/3 times: baseline scrub
> returned 0 with "finished ... status: 0", left P/Q unregenerated, and a
> device replace copied corruption.  With this change scrub returns -EIO
> and the replace is canceled; healthy RAID1/RAID5 scrub still succeeds.
> 
> Assisted-by: LLM
> Signed-off-by: Cheng Yongkang <teel4res@gmail.com>

Reviewed-by: Qu Wenruo <wqu@suse.com>

> ---
>   fs/btrfs/scrub.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/fs/btrfs/scrub.c b/fs/btrfs/scrub.c
> index 479c0e0..ba2e27c 100644
> --- a/fs/btrfs/scrub.c
> +++ b/fs/btrfs/scrub.c
> @@ -2250,7 +2250,7 @@ static int scrub_raid56_parity_stripe(struct scrub_ctx *sctx,
>   "scrub: unrepaired sectors detected, full stripe %llu data stripe %u errors %*pbl",
>   				  full_stripe_start, i, stripe->nr_sectors,
>   				  &error);
> -			return ret;
> +			return -EIO;
>   		}
>   		bitmap_or(&extent_bitmap, &extent_bitmap, &has_extent,
>   			  stripe->nr_sectors);


  reply	other threads:[~2026-10-26  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-25 18:03 Cheng Yongkang
2026-10-26  6:52 ` Qu Wenruo [this message]
2026-10-26  9:09 ` Filipe Manana

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=96b705a1-81ad-4e89-af71-a27d009333b8@suse.com \
    --to=wqu@suse.com \
    --cc=dsterba@suse.com \
    --cc=linux-btrfs@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mason@kernel.org \
    --cc=teel4res@gmail.com \
    /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

all inboxes | Powered by JetHome®