[Devel] [PATCH RH7] ploop: call check_lockout() under ploop->lock

Kirill Tkhai ktkhai at virtuozzo.com
Fri Sep 18 17:57:11 MSK 2020


Parallel ploop_make_request() may modify lockout tree
via try_merge()->overlap_{forward,backward}(), so
check_lockout() must access to the tree under the lock.

Found in scope of (not a reason of):
https://jira.sw.ru/browse/PSBM-108002

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/block/ploop/dev.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/block/ploop/dev.c b/drivers/block/ploop/dev.c
index c09cafc..ac4d142 100644
--- a/drivers/block/ploop/dev.c
+++ b/drivers/block/ploop/dev.c
@@ -2403,10 +2403,13 @@ ploop_entry_request(struct ploop_request * preq)
 		}
 	}
 
+	spin_lock_irq(&plo->lock);
 	if (check_lockout(preq)) {
+		spin_unlock_irq(&plo->lock);
 		__TRACE("l %p %u\n", preq, preq->req_cluster);
 		return;
 	}
+	spin_unlock_irq(&plo->lock);
 
 	/* push_backup special processing */
 	if (!test_bit(PLOOP_REQ_PB_LOCKOUT, &preq->state) &&



More information about the Devel mailing list