Re: [PATCH] md: remove REQ_NOWAIT support
From: yu kuai
Date: Thu Jul 30 2026 - 08:50:20 EST
Hi,
在 2026/7/30 19:07, Jens Axboe 写道:
> On 7/30/26 4:50 AM, yu kuai wrote:
>> Hi,
>>
>> ? 2026/6/28 22:27, Abd-Alrhman Masalkhi ??:
>>> REQ_NOWAIT support in md is fundamentally incomplete. While reads can
>>> avoid some blocking paths, write requests can still encounter cases
>>> where one mirror succeeds while another returns -EAGAIN. At that point
>>> md cannot distinguish queue pressure from a real device failure, so it
>>> can neither record a bad block nor safely retry the write without
>>> REQ_NOWAIT, leaving mirrors with divergent data.
>>>
>>> Rather than continue advertising REQ_NOWAIT support that cannot be
>>> implemented correctly, remove it from md and its raid personalities.
>>> This simplifies the waiting paths and avoids exposing incorrect
>>> non-blocking semantics.
>>>
>>> Fixes: bf2c411bb1cf ("md: raid456 add nowait support")
>>> Fixes: c9aa889b035f ("md: raid10 add nowait support")
>>> Fixes: 5aa705039c4f ("md: raid1 add nowait support")
>>> Fixes: f51d46d0e7cb ("md: add support for REQ_NOWAIT")
>>> Suggested-by: Yu Kuai<yukuai@xxxxxxx>
>>> Signed-off-by: Abd-Alrhman Masalkhi<abd.masalkhi@xxxxxxxxx>
>>> ---
>>> drivers/md/md-bitmap.c | 9 +---
>>> drivers/md/md-bitmap.h | 2 +-
>>> drivers/md/md-llbitmap.c | 10 +----
>>> drivers/md/md.c | 15 ++-----
>>> drivers/md/raid1-10.c | 8 ++--
>>> drivers/md/raid1.c | 91 +++++++++-------------------------------
>>> drivers/md/raid10.c | 80 +++++++++--------------------------
>>> drivers/md/raid5.c | 13 ------
>>> 8 files changed, 51 insertions(+), 177 deletions(-)
>> Applied to md-7.3 with a few changes, please check:
>>
>> md: remove REQ_NOWAIT support from raid1/10/456 -
>> kernel/git/mdraid/linux.git - song's fork of linux.git <https://git.kernel.org/pub/scm/linux/kernel/git/mdraid/linux.git/commit/?h=md-7.3&id=3fe5b7c9fb72ccc29bfd0f955b124892af7e3674>
>>
>> - rebase raid1/raid10 with latest code;
>> - keep nowait for raid0/linear;
>> - keep nowait for md_handle_request, as raid0/linear will need it;
> What's the plan for making REQ_NOWAIT _actually_ work with md? Just
> yanking it wholesale is a massive performance problem, and it will
> regress workloads. Has any time been spent on making this more solid?
For raid1/10/56, if anyone is still using nowait they should stop, because there is
risk of data lost or wrong data being read.
And yes, I tried, but I can't figure out a solid solution for the case that, if nowait
IO issue to one disk succeed while another disk failed. We can't either issue again without
nowait from mdraid because it's against nowait principle, or record badblocks (which is
currently what mdraid did) because data can be lost. Hence, the array will have to do additional
data synchronization in this case, while nowait issue failure is not a slow path that performance
overhead can be ignored.
>
--
Thanks,
Kuai