[RHEL7,COMMIT] ploop: call check_lockout() under ploop->lock

Submitted by Vasily Averin on Sept. 20, 2020, 8:55 a.m.

Details

Message ID 202009200855.08K8tQcM010673@vz7build.vvs.sw.ru
State New
Series "ploop: call check_lockout() under ploop->lock"
Headers show

Commit Message

Vasily Averin Sept. 20, 2020, 8:55 a.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.25
------>
commit ee99f225c69823f710c3ddbd363ccfdfd81e682f
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Sun Sep 20 11:55:26 2020 +0300

    ploop: call check_lockout() under ploop->lock
    
    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 @@  restart:
 		}
 	}
 
+	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) &&