Re: [PATCH -next 1/3] md/raid10: fix improper BUG_ON() in raise_barrier()

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

 



>>>>> "Yu" == Yu Kuai <yukuai1@xxxxxxxxxxxxxxx> writes:

Yu> From: Yu Kuai <yukuai3@xxxxxxxxxx>
Yu> 'conf->barrier' is protected by 'conf->resync_lock', reading
Yu> 'conf->barrier' without holding the lock is wrong.

Yu> Signed-off-by: Yu Kuai <yukuai3@xxxxxxxxxx>
Yu> ---
Yu>  drivers/md/raid10.c | 2 +-
Yu>  1 file changed, 1 insertion(+), 1 deletion(-)

Yu> diff --git a/drivers/md/raid10.c b/drivers/md/raid10.c
Yu> index 9117fcdee1be..b70c207f7932 100644
Yu> --- a/drivers/md/raid10.c
Yu> +++ b/drivers/md/raid10.c
Yu> @@ -930,8 +930,8 @@ static void flush_pending_writes(struct r10conf *conf)
 
Yu>  static void raise_barrier(struct r10conf *conf, int force)
Yu>  {
Yu> -	BUG_ON(force && !conf->barrier);
Yu>  	spin_lock_irq(&conf->resync_lock);
Yu> +	BUG_ON(force && !conf->barrier);

I don't like this BUG_ON() at all, why are you crashing the system
here instead of just doing a simple WARN_ONCE() instead?  Is there
anything the user can do to get into this situation on their own, or
does it really signify a logic error in the code?  If so, why are you
killing the system?


 
Yu>  	/* Wait until no block IO is waiting (unless 'force') */
Yu>  	wait_event_lock_irq(conf->wait_barrier, force || !conf->nr_waiting,
Yu> -- 
Yu> 2.31.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