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

Submitted by Kirill Tkhai on Sept. 18, 2020, 2:57 p.m.

Details

Message ID 160044100789.4202.5603933614335498201.stgit@qvm3002.qa.sw.ru
State New
Series "ploop: call check_lockout() under ploop->lock"
Headers show

Commit Message

Kirill Tkhai Sept. 18, 2020, 2:57 p.m.
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@virtuozzo.com>
---
 drivers/block/ploop/dev.c |    3 +++
 1 file changed, 3 insertions(+)

Patch hide | download patch | download mbox

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