[Devel] [PATCH RH8] ploop: Use down_write() in ploop_set_suspended()

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 15 17:29:07 MSK 2021


ploop: Use down_write() in ploop_set_suspended()
    
Variable assignment definitely requires WRITE-taken rwsem.
   
Also, remove unused function.

v2: Remove ".preresume =    "
Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 472f5aed73e5..7e04993084b7 100644
--- a/drivers/md/dm-ploop-target.c
+++ b/drivers/md/dm-ploop-target.c
@@ -457,9 +457,9 @@ static void ploop_set_suspended(struct dm_target *ti, bool suspended)
 {
 	struct ploop *ploop = ti->private;
 
-	down_read(&ploop->ctl_rwsem);
+	down_write(&ploop->ctl_rwsem);
 	ploop->suspended = suspended;
-	up_read(&ploop->ctl_rwsem);
+	up_write(&ploop->ctl_rwsem);
 }
 
 static void ploop_presuspend(struct dm_target *ti)
@@ -502,9 +502,6 @@ static int ploop_preresume(struct dm_target *ti)
 	}
 	return ret;
 }
-static void ploop_resume(struct dm_target *ti)
-{
-}
 
 /*----------------------------------------------------------------*/
 
@@ -521,7 +518,6 @@ static struct target_type ploop_target = {
 	.presuspend_undo = ploop_presuspend_undo,
 	.postsuspend = ploop_postsuspend,
 	.preresume = ploop_preresume,
-	.resume = ploop_resume,
 	.clone_and_map_rq = ploop_clone_and_map,
 	.status = ploop_status,
 };


More information about the Devel mailing list