Re: [patch]raid5: delete another BUG_ON

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

 



On Mon, 14 Apr 2014 14:14:17 +0800 Shaohua Li <shli@xxxxxxxxxx> wrote:

> 
> I hit another BUG_ON with e240c1839d11152b0355442. In __get_priority_stripe(),
> stripe count equals to 0 initially. Between atomic_inc and BUG_ON,
> get_active_stripe() finds the stripe. So the stripe count isn't 1 any more.
> 
> Signed-off-by: Shaohua Li <shli@xxxxxxxxxxxx>
> ---
>  drivers/md/raid5.c |    1 -
>  1 file changed, 1 deletion(-)
> 
> Index: linux/drivers/md/raid5.c
> ===================================================================
> --- linux.orig/drivers/md/raid5.c	2014-04-14 11:44:11.448492119 +0800
> +++ linux/drivers/md/raid5.c	2014-04-14 11:52:19.158359774 +0800
> @@ -4371,7 +4371,6 @@ static struct stripe_head *__get_priorit
>  	}
>  	list_del_init(&sh->lru);
>  	atomic_inc(&sh->count);
> -	BUG_ON(atomic_read(&sh->count) != 1);
>  	return sh;
>  }
>  

What if we made those two lines:
 
  BUG_ON(atomic_inc_return(&sh->count) != 1);

??

NeilBrown

Attachment: signature.asc
Description: PGP signature


[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