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

Submitted by Vasily Averin on Oct. 12, 2020, 4:07 p.m.

Details

Message ID 202010121607.09CG7xC7015855@vz7build.vvs.sw.ru
State New
Series "ploop: Wake up on last discard bio from ploop_complete_request()"
Headers show

Commit Message

Vasily Averin Oct. 12, 2020, 4:07 p.m.
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@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@virtuozzo.com>
---
 drivers/block/ploop/dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

Patch hide | download patch | download mbox

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) {