[Devel] [PATCH RHEL7 COMMIT] ploop: Wake up on last discard bio from ploop_complete_request()

Vasily Averin vvs at virtuozzo.com
Mon Oct 12 19:07:59 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.36
------>
commit 3d869e1c074a5ca9cecee94d1b604e247f35be7e
Author: Kirill Tkhai <ktkhai at virtuozzo.com>
Date:   Mon Oct 12 19:07:59 2020 +0300

    ploop: Wake up on last discard bio from ploop_complete_request()
    
    Concurrent thread waits that on pending_waitq.
    
    https://jira.sw.ru/browse/PSBM-121135
    Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index d6edbfb..320a5d5 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -1461,8 +1461,11 @@ static void ploop_complete_request(struct ploop_request * preq)
 	 */
 	spin_lock_irq(&plo->lock);
 	plo->active_reqs--;
-	if (preq->req_rw & REQ_DISCARD)
-		plo->discard_inflight_reqs--;
+	if (preq->req_rw & REQ_DISCARD) {
+		if (!--plo->discard_inflight_reqs &&
+		    waitqueue_active(&plo->pending_waitq))
+			wake_up(&plo->pending_waitq);
+	}
 	spin_unlock_irq(&plo->lock);
 
 	while (preq->bl.head) {


More information about the Devel mailing list