Re: [PATCH] md/raid5: Assigning NULL to sh->batch_head before testing bit R5_Overlap of a stripe

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

 



On Wed, May 16, 2018 at 06:59:35PM +0800, Amy Chiang wrote:
> In add_stripe_bio(), if the stripe_head is in batch list, the incoming
> bio is regarded as overlapping, and the bit R5_Overlap on this stripe_head
> is set. break_stripe_batch_list() checks bit R5_Overlap on each stripe_head
> first then assigns NULL to sh->batch_head.
> 
> If break_stripe_batch_list() checks bit R5_Overlap on stripe_head A
> after add_stripe_bio() finds stripe_head A is in batch list and before
> add_stripe_bio() sets bit R5_Overlapt of stripe_head A,
> break_stripe_batch_list() would not know there's a process in
> wait_for_overlap and needs to call wake_up(). There's a huge chance a
> process never returns from schedule() if add_stripe_bio() is called
> from raid5_make_request().
> 
> In break_stripe_batch_list(), assigning NULL to sh->batch_head should
> be done before it checks bit R5_Overlap of a stripe_head.

Applied, thanks!
 
> Signed-off-by: Amy Chiang <amychiang@xxxxxxxx>
> ---
>  drivers/md/raid5.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c
> index 928e24a..65f9af0 100644
> --- a/drivers/md/raid5.c
> +++ b/drivers/md/raid5.c
> @@ -4611,15 +4611,15 @@ static void break_stripe_batch_list(struct stripe_head *head_sh,
>  
>  		sh->check_state = head_sh->check_state;
>  		sh->reconstruct_state = head_sh->reconstruct_state;
> +		spin_lock_irq(&sh->stripe_lock);
> +		sh->batch_head = NULL;
> +		spin_unlock_irq(&sh->stripe_lock);
>  		for (i = 0; i < sh->disks; i++) {
>  			if (test_and_clear_bit(R5_Overlap, &sh->dev[i].flags))
>  				do_wakeup = 1;
>  			sh->dev[i].flags = head_sh->dev[i].flags &
>  				(~((1 << R5_WriteError) | (1 << R5_Overlap)));
>  		}
> -		spin_lock_irq(&sh->stripe_lock);
> -		sh->batch_head = NULL;
> -		spin_unlock_irq(&sh->stripe_lock);
>  		if (handle_flags == 0 ||
>  		    sh->state & handle_flags)
>  			set_bit(STRIPE_HANDLE, &sh->state);
> -- 
> 2.7.4
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-raid" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[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