# Re: \[PATCH\] Fix race between removing raid1 device and I/O error handling on underlying device

- List: linux-raid
- 1 message, 1 author
- Page: https://ratatoskr.run/linux-raid/2012/10/6621997/t

## Re: \[PATCH\] Fix race between removing raid1 device and I/O error handling on underlying device

- From: Jes Sorensen \<hidden\>
- Date: 2012-10-09 06:39:11 
- Message: https://ratatoskr.run/linux-raid/2012/10/6621997.md

```text
NeilBrown [ref] writes:
>> diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c
>> index 611b5f7..ffdad74 100644
>> --- a/drivers/md/raid1.c
>> +++ b/drivers/md/raid1.c
>> @@ -2005,7 +2005,7 @@ static void fix_read_error(struct r1conf *conf, int read_disk,
>>  		if (!success) {
>>  			/* Cannot read from anywhere - mark it bad */
>>  			struct md_rdev *rdev = conf->mirrors[read_disk].rdev;
>> -			if (!rdev_set_badblocks(rdev, sect, s, 0))
>> +			if (rdev && !rdev_set_badblocks(rdev, sect, s, 0))
>>  				md_error(mddev, rdev);
>>  			break;
>>  		}
>
>
> Hi Jes,
> this was already reported on linux-raid and I said I didn't like that fix
> because I think it is wrong that the rdev could be removed while we are
> trying to fix a read error on it.
> So I've applied this following which is in -next.
>
> NeilBrown

Hi Neil,

Whoops, I have to admit I am somewhat backlogged on linux-raid.
Apologies for the noise.

I wasn't wildly happy with the solution myself, but I figured it was the
simplest solution. 

Your patch looks good to me, so I'll go with that.

Cheers,
Jes
```
