[RHEL8,COMMIT] ploop: Do not take ctl_mutex on noresume check

Submitted by Konstantin Khorenko on Oct. 25, 2019, 2:09 p.m.


Message ID 201910251409.x9PE9ein004806@finist_co8.work.ct
State New
Series "ploop: Do not take ctl_mutex on noresume check"
Headers show

Commit Message

Konstantin Khorenko Oct. 25, 2019, 2:09 p.m.
The commit is pushed to "branch-rh8-4.18.0-80.1.2.vz8.2.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-80.1.2.vz8.2.3
commit 2ee8bc18c6a05bdcfd6c63e31e35737d3c3f9dbc
Author: Kirill Tkhai <ktkhai@virtuozzo.com>
Date:   Fri Oct 25 17:09:40 2019 +0300

    ploop: Do not take ctl_mutex on noresume check
    Ideally, we should take md->suspend_lock in ploop_set_noresume()
    instead of this, but it is prohibited for targets.
    It looks like not taking a lock at all is not a problem here,
    since this is a helper for userspace to check it goes wrong.
    Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
 drivers/md/dm-ploop-target.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Patch hide | download patch | download mbox

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index a5abcac11c14..999f78a05977 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -270,10 +270,8 @@  static int ploop_preresume(struct dm_target *ti)
 	struct ploop *ploop = ti->private;
 	int ret = 0;
-	mutex_lock(&ploop->ctl_mutex);
-	if (ploop->noresume)
+	if (READ_ONCE(ploop->noresume))
 		ret = -EAGAIN;
-	mutex_unlock(&ploop->ctl_mutex);
 	return ret;