Re: [PATCH v2 3/4] md/raid10: fix wrong setting of max_corr_read_errors

From: Li Nan
Date: Sun May 14 2023 - 07:08:24 EST

在 2023/5/13 10:21, Yu Kuai 写道:

在 2023/05/13 9:08, Song Liu 写道:
On Fri, May 5, 2023 at 7:02 PM Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> wrote:


在 2023/05/06 9:23, linan666@xxxxxxxxxxxxxxx 写道:
From: Li Nan <linan122@xxxxxxxxxx>

max_corr_read_errors should not be negative number. Change it to
unsigned int where use it.

Looks good, feel free to add:

Reviewed-by: Yu Kuai <yukuai3@xxxxxxxxxx>

Fixes: 1e50915fe0bb ("raid: improve MD/raid10 handling of correctable read errors.")
Signed-off-by: Li Nan <linan122@xxxxxxxxxx>

Hmm.. Does the current code break in any cases?

The problem is that somewhere use unsigned value, and somewhere use
signed value, and I thinsk the only functional change is in
fix_read_error(), if max_read_errors is negative, the judgement will
always pass before this patch:

if (atomic_read(&rdev->read_errors) > max_read_errors)

In addition, it is confusing for users after setting a huge number to it.
# echo 4294967295 > /sys/block/$disk/md/max_read_errors
# cat /sys/block/$disk/md/max_read_errors