Re: [PATCH] md/raid1: properly indicate failure when ending a failed write request

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Apr 20, 2021 at 3:05 PM Paul Clements <paul.clements@xxxxxxxxxxx> wrote:
>
> This patch addresses a data corruption bug in raid1 arrays using bitmaps.
> Without this fix, the bitmap bits for the failed I/O end up being cleared.

I think this only happens when we re-add a faulty drive?

Thanks,
Song

>
> Since we are in the failure leg of raid1_end_write_request, the request
> either needs to be retried (R1BIO_WriteError) or failed (R1BIO_Degraded).
>
> Signed-off-by: Paul Clements <paul.clements@xxxxxxxxxxx>
>
> ---
>  drivers/md/raid1.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
> index d2378765dc15..ced076ba560e 100644
> --- a/drivers/md/raid1.c
> +++ b/drivers/md/raid1.c
> @@ -478,6 +478,8 @@ static void raid1_end_write_request(struct bio *bio)
>                 if (!test_bit(Faulty, &rdev->flags))
>                         set_bit(R1BIO_WriteError, &r1_bio->state);
>                 else {
> +                       /* Fail the request */
> +                       set_bit(R1BIO_Degraded, &r1_bio->state);
>                         /* Finished with this branch */
>                         r1_bio->bios[mirror] = NULL;
>                         to_put = bio;
> --
> 2.17.1
>



[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux