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

Kirill Tkhai ktkhai at virtuozzo.com
Thu Jul 15 15:42:47 MSK 2021


Variable assignment definitely requires WRITE-taken rwsem.

Also, remove unused function.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
---
 drivers/md/dm-ploop-target.c |    7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/md/dm-ploop-target.c b/drivers/md/dm-ploop-target.c
index 472f5aed73e5..c0fa9b973ab9 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)
-{
-}
 
 /*----------------------------------------------------------------*/
 




More information about the Devel mailing list