Linux RAID subsystem development
 help / color / mirror / Atom feed
From: "Yu Kuai" <yukuai@fnnas.com>
To: "G.W. Kant - Hunenet B.V." <g.w.kant@hunenet.nl>,
	 "Abd-Alrhman Masalkhi" <abd.masalkhi@gmail.com>,
	 "linux-raid@vger.kernel.org" <linux-raid@vger.kernel.org>,
	 "yu kuai" <yukuai@fygo.io>
Subject: Re: Subject: RFC: Read repair for md RAID1 after mirror read failures
Date: Wed, 15 Jul 2026 15:27:27 +0800	[thread overview]
Message-ID: <2718fd27-9453-4dea-9d1d-13cfecef4e6c@fnnas.com> (raw)
In-Reply-To: <368d1223-1d41-4227-af33-bd6bd00b5c3d@hunenet.nl>

Hi,

在 2026/7/15 15:10, G.W. Kant - Hunenet B.V. 写道:
> On 7/15/26 7:27 AM, Abd-Alrhman Masalkhi wrote:
>>> In other words, the first successfully recovered read request could
>>> automatically become a repair opportunity. The repair could even be
>>> scheduled asynchronously, so the successful read is returned immediately
>>> while the rewrite is performed in the background. Unlike a periodic
>>> resync, this repair would be driven by an actual read failure, making it
>>> targeted rather than rewriting the entire mirror.
>>>
>> Yes, md has had this for a long time. Look at fix_read_error() in
>> raid1.c. It is called from handle_read_error() on any failed read. It
>> reads from a healthy mirror and rewrites the bad region on the failing
>> device, giving the drive a chance to rewrite or remap the sector. If the
>> rewrite fails, it records a bad block. md does this synchronously under
>> a frozen array, so it is not a missing feature.
>>
>> The likely reason you didn't see it is that your array was already
>> degraded, so there was no healthy in-array copy for fix_read_error() to
>> recover from. In your case, you were likely able to retrieve the data
>> due to btrfs level redundancy, and md can't repair across arrays.
>>
>>> With today's 18–24 TB HDDs and backup/archive workloads, where data may
>>> remain unchanged for years, latent media degradation seems increasingly
>>> relevant. A successful read from the alternate mirror may be one of the
>>> last opportunities to refresh such a sector before it becomes
>>> permanently unreadable.
>>>
>> And Check/Repair is the right defense for cold archival data on large
>> drives.
> Thank you. fix_read_error() was exactly the piece I was looking for. I
> had missed that md already performs read repair when another healthy
> mirror is available.
>
> My situation was indeed different because the array had already lost one
> member, so the successful read originated from Btrfs redundancy across
> another md RAID1 rather than from the surviving md mirror.
>
> One question remains, though. check/repair periodically reads all
> sectors, but as far as I understand it, successfully read sectors are
> not rewritten. From a media aging perspective this is a different
> problem than recovering from a read error. Have there ever been
> discussions about a true media refresh pass that rewrites successfully
> read sectors to refresh long-lived magnetic recordings?

Perhaps this is what you looking for:

[RFC v2 0/5] md/raid1: introduce a new sync action to repair badblocks - 
Zheng Qixing 
<https://lore.kernel.org/all/20260203061259.609206-1-zhengqixing@huaweicloud.com/>

However, AFAIK, Qixing no longer work in this area and there will not be 
new version.

>
> Best regards,
> Dion Kant

-- 
Thanks,
Kuai

  reply	other threads:[~2026-07-15  7:27 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15  2:52 Subject: RFC: Read repair for md RAID1 after mirror read failures G.W. Kant - Hunenet B.V.
2026-07-15  5:27 ` Abd-Alrhman Masalkhi
2026-07-15  7:10   ` G.W. Kant - Hunenet B.V.
2026-07-15  7:27     ` Yu Kuai [this message]
2026-07-15 11:24       ` G.W. Kant - Hunenet B.V.
2026-07-15 17:53       ` Abd-Alrhman Masalkhi
2026-07-15 14:13   ` G.W. Kant - Hunenet B.V.
2026-07-15 16:27     ` John Stoffel
2026-07-15 17:01       ` Dragan Milivojević
2026-07-15 17:41     ` Abd-Alrhman Masalkhi
2026-07-15 18:04       ` Abd-Alrhman Masalkhi

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=2718fd27-9453-4dea-9d1d-13cfecef4e6c@fnnas.com \
    --to=yukuai@fnnas.com \
    --cc=abd.masalkhi@gmail.com \
    --cc=g.w.kant@hunenet.nl \
    --cc=linux-raid@vger.kernel.org \
    --cc=yukuai@fygo.io \
    /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