public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] zram: do not lookup algorithm in backends table
@ 2022-06-22  2:35 Sergey Senozhatsky
  2022-06-22 15:20 ` Sergey Senozhatsky
  0 siblings, 1 reply; 4+ messages in thread
From: Sergey Senozhatsky @ 2022-06-22  2:35 UTC (permalink / raw)
  To: Minchan Kim, Nitin Gupta
  Cc: Andrew Morton, linux-kernel, linux-block, Sergey Senozhatsky

Always use crypto_has_comp() so that crypto can lookup module,
call usermodhelper to load the modules, wait for usermodhelper
to finish and so on. Otherwise crypto will do all of these steps
under CPU hot-plug lock and this looks like too much stuff to
handle under the CPU hot-plug lock. Besides this can end up in
a deadlock when usermodhelper triggers a code path that attempts
to lock the CPU hot-plug lock, that zram already holds.

Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
---
 drivers/block/zram/zcomp.c | 6 ------
 1 file changed, 6 deletions(-)

diff --git a/drivers/block/zram/zcomp.c b/drivers/block/zram/zcomp.c
index 052aa3f65514..398eb9e24eff 100644
--- a/drivers/block/zram/zcomp.c
+++ b/drivers/block/zram/zcomp.c
@@ -63,12 +63,6 @@ static int zcomp_strm_init(struct zcomp_strm *zstrm, struct zcomp *comp)
 
 bool zcomp_available_algorithm(const char *comp)
 {
-	int i;
-
-	i = sysfs_match_string(backends, comp);
-	if (i >= 0)
-		return true;
-
 	/*
 	 * Crypto does not ignore a trailing new line symbol,
 	 * so make sure you don't supply a string containing
-- 
2.37.0.rc0.104.g0611611a94-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-06-23  0:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-22  2:35 [PATCH] zram: do not lookup algorithm in backends table Sergey Senozhatsky
2022-06-22 15:20 ` Sergey Senozhatsky
2022-06-22 19:19   ` Andrew Morton
2022-06-23  0:21     ` Sergey Senozhatsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox