summaryrefslogtreecommitdiff
path: root/src/modules-load
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-08 16:21:06 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-10-08 22:29:45 +0200
commit6cbb0af16e41f8ed665b07f75738c24eea4de8a5 (patch)
treeff6ec79a9dc6d3788d50f7746ee083987b387af2 /src/modules-load
parent2c3f0bb207f89f0347a4a84a8cde57e979f33896 (diff)
downloadsystemd-6cbb0af16e41f8ed665b07f75738c24eea4de8a5.tar.gz
modules-load: downgrade error on ENODEV/ENOENT
Some kernel modules may be loaded if the hardware does not exist (usually when the hardware is hot-pluggable), while others fail with ENODEV. Let's make those two cases more similar, and simply log modules which cannot be loaded because of missing hardware without failing systemd-modules-load.service. For modules which don't exist, let's warn, but not fail the whole service. I think a warning is appropriate because it's likely that a typo was made.
Diffstat (limited to 'src/modules-load')
-rw-r--r--src/modules-load/modules-load.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/modules-load/modules-load.c b/src/modules-load/modules-load.c
index c1a89cf822..aaf2927113 100644
--- a/src/modules-load/modules-load.c
+++ b/src/modules-load/modules-load.c
@@ -119,8 +119,15 @@ static int load_module(struct kmod_ctx *ctx, const char *m) {
log_info("Module '%s' is blacklisted", kmod_module_get_name(mod));
else {
assert(err < 0);
- r = log_error_errno(err, "Failed to insert '%s': %m",
- kmod_module_get_name(mod));
+
+ log_full_errno(err == ENODEV ? LOG_NOTICE :
+ err == ENOENT ? LOG_WARNING :
+ LOG_ERR,
+ err,
+ "Failed to insert '%s': %m",
+ kmod_module_get_name(mod));
+ if (!IN_SET(err, ENODEV, ENOENT))
+ r = err;
}
}
}