Skip to contentSkip to conversation

target: Don't request modules that aren't even built

PATCH Applied Roland Dreier 3 participants 3 messages Oct 20, 2018 – Oct 24, 2018 SCSI target

lore
Share & tools
lore
#0 lore raw

PATCH 2/2 target: Don't request modules that aren't even built

From: Roland Dreier <[email protected]>

If, for example, I don't enable CONFIG_TCM_PSCSI, then every time I load the target subsystem, I get an annoying

Unable to load target_core_pscsi

kernel log message. Instead let's only request_module() on things if that code is enabled.

---
 drivers/target/target_core_transport.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/target/target_core_transport.c +4 -4
index 86c0156e6c88..eee222db0a14 100644
@@ -205,19 +205,19 @@ void transport_subsystem_check_init(void)
 	if (sub_api_initialized)
 		return;
 
-	ret = request_module("target_core_iblock");
+	ret = IS_ENABLED(CONFIG_TCM_IBLOCK) && request_module("target_core_iblock");
 	if (ret != 0)
 		pr_err("Unable to load target_core_iblock\n");
 
-	ret = request_module("target_core_file");
+	ret = IS_ENABLED(CONFIG_TCM_FILEIO) && request_module("target_core_file");
 	if (ret != 0)
 		pr_err("Unable to load target_core_file\n");
 
-	ret = request_module("target_core_pscsi");
+	ret = IS_ENABLED(CONFIG_TCM_PSCSI) && request_module("target_core_pscsi");
 	if (ret != 0)
 		pr_err("Unable to load target_core_pscsi\n");
 
-	ret = request_module("target_core_user");
+	ret = IS_ENABLED(CONFIG_TCM_USER2) && request_module("target_core_user");
 	if (ret != 0)
 		pr_err("Unable to load target_core_user\n");
 
Signature · 1 line
2.19.1
Reviewed-by on v1 2/2
#1 lore raw
Quoted 11 lines · Roland Dreier

From: Roland Dreier <[email protected]>

If, for example, I don't enable CONFIG_TCM_PSCSI, then every time I load the target subsystem, I get an annoying

Unable to load target_core_pscsi

kernel log message. Instead let's only request_module() on things if that code is enabled.

I guess this ok. I aways thought these request_module calls were a horrible idea to start with, but just removing them now migh break existing setups..

#2 lore raw
In reply to Roland Dreier

Roland,

Quoted 7 lines

If, for example, I don't enable CONFIG_TCM_PSCSI, then every time I load the target subsystem, I get an annoying

Unable to load target_core_pscsi

kernel log message. Instead let's only request_module() on things if that code is enabled.

Applied to 4.20/scsi-queue, thank you!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering