]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
modules-load: downgrade error on ENODEV/ENOENT 7034/head
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 8 Oct 2017 14:21:06 +0000 (16:21 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 8 Oct 2017 20:29:45 +0000 (22:29 +0200)
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.

src/modules-load/modules-load.c

index c1a89cf822a0d08aa54dadcbffbad052424f9414..aaf29271132b3d37243d3cde1ee22232bb867dc2 100644 (file)
@@ -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;
                         }
                 }
         }