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

Konstantin Khorenko khorenko at virtuozzo.com
Fri Oct 25 17:09:42 MSK 2019


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 at 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 at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

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;
 }
 



More information about the Devel mailing list