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

Kirill Tkhai ktkhai at virtuozzo.com
Mon Oct 12 13:08:47 MSK 2020


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 d6edbfbe4422..320a5d55d65b 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