]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
mount: be more descriptive when logging about overly long mount point paths 19779/head
authorLennart Poettering <lennart@poettering.net>
Tue, 1 Jun 2021 20:26:49 +0000 (22:26 +0200)
committerLennart Poettering <lennart@poettering.net>
Tue, 1 Jun 2021 21:08:21 +0000 (23:08 +0200)
This is prompted by #17684: let's very explicitly say that the name is
too long for us, and that we'll ignore it.

src/core/mount.c

index 07d8e7b98574acc44ed0c3ee4dfc0116bb2e8b32..c1f36ac4f14e9accb60834c5d2b554c21a90100c 100644 (file)
@@ -1713,11 +1713,18 @@ static int mount_setup_unit(
                         .burst = 1,
                 };
 
+                if (r == -ENAMETOOLONG)
+                        return log_struct_errno(
+                                        ratelimit_below(&rate_limit) ? LOG_WARNING : LOG_DEBUG, r,
+                                        "MESSAGE_ID=" SD_MESSAGE_MOUNT_POINT_PATH_NOT_SUITABLE_STR,
+                                        "MOUNT_POINT=%s", where,
+                                        LOG_MESSAGE("Mount point path '%s' too long to fit into unit name, ignoring mount point.", where));
+
                 return log_struct_errno(
                                 ratelimit_below(&rate_limit) ? LOG_WARNING : LOG_DEBUG, r,
                                 "MESSAGE_ID=" SD_MESSAGE_MOUNT_POINT_PATH_NOT_SUITABLE_STR,
                                 "MOUNT_POINT=%s", where,
-                                LOG_MESSAGE("Failed to generate valid unit name from path '%s', ignoring mount point: %m", where));
+                                LOG_MESSAGE("Failed to generate valid unit name from mount point path '%s', ignoring mount point: %m", where));
         }
 
         u = manager_get_unit(m, e);