[Devel] [PATCH RHEL7 COMMIT] ploop: Also decrement active_reqs before bio_endio() in ploop_complete_request()

Kirill Tkhai ktkhai at virtuozzo.com
Tue Jun 25 18:05:07 MSK 2019


https://jira.sw.ru/browse/PSBM-95750

On 25.06.2019 12:41, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-957.12.2.vz7.96.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-957.12.2.vz7.96.18
> ------>
> commit 1e9820286b81c11d4d0da063e093a4ee1c8393fb
> Author: Kirill Tkhai <ktkhai at virtuozzo.com>
> Date:   Tue Jun 25 12:41:10 2019 +0300
> 
>     ploop: Also decrement active_reqs before bio_endio() in ploop_complete_request()
>     
>     This is needed for ploop_ioctl() debug hook correct work.
>     
>     Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> ---
>  drivers/block/ploop/dev.c | 12 +++++++++---
>  1 file changed, 9 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
> index 10b4abc00592..64d205e691ba 100644
> --- a/drivers/block/ploop/dev.c
> +++ b/drivers/block/ploop/dev.c
> @@ -1344,6 +1344,15 @@ static void ploop_complete_request(struct ploop_request * preq)
>  
>  	__TRACE("Z %p %u\n", preq, preq->req_cluster);
>  
> +	/*
> +	 * Decrement active_reqs before BIO_IOEND() to make
> +	 * a hook in ploop_stop() work properly. This is
> +	 * mostly needed for debug purposes.
> +	 */
> +	spin_lock_irq(&plo->lock);
> +	plo->active_reqs--;
> +	spin_unlock_irq(&plo->lock);
> +
>  	while (preq->bl.head) {
>  		struct bio * bio = preq->bl.head;
>  		preq->bl.head = bio->bi_next;
> @@ -1382,7 +1391,6 @@ static void ploop_complete_request(struct ploop_request * preq)
>  
>  				if (!list_empty(&preq->delay_list))
>  					list_splice_init(&preq->delay_list, plo->ready_queue.prev);
> -				plo->active_reqs--;
>  
>  				preq->eng_state = PLOOP_E_ENTRY;
>  				ploop_entry_add(plo, preq);
> @@ -1437,8 +1445,6 @@ static void ploop_complete_request(struct ploop_request * preq)
>  	preq->preq_ub = NULL;
>  #endif
>  
> -	plo->active_reqs--;
> -
>  	if (unlikely(test_bit(PLOOP_REQ_ZERO, &preq->state))) {
>  		ploop_fb_put_zero_request(plo->fbd, preq);
>  	} else {
> 



More information about the Devel mailing list