From: Daan De Meyer Date: Fri, 16 Jan 2026 20:21:06 +0000 (+0100) Subject: core: Improve logging when we cannot create destination mountpoint X-Git-Tag: v257.11~77 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b1984ae62452f61c1d8e39ec230e0a472173d025;p=thirdparty%2Fsystemd.git core: Improve logging when we cannot create destination mountpoint If we fail to create a parent directory, then the error from make_mount_point_inode_from_path() will always be "No such file or directory" which doesn't tell us anything. Add logging for the mkdir_parents() call as well so we get a useful error. (cherry picked from commit b231c4dcb4f54332b16a5bcf75df34b76c5e4b01) (cherry picked from commit e82f1e05a4ecad446ba6474f9c0af24a119a329f) (cherry picked from commit b6010cbeeccb79c07f43db9af9c0c182af0b32b1) --- diff --git a/src/core/namespace.c b/src/core/namespace.c index 8f3a9e875cc..9eb9fa38575 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1898,15 +1898,20 @@ static int apply_one_mount( /* Hmm, either the source or the destination are missing. Let's see if we can create the destination, then try again. */ - (void) mkdir_parents(mount_entry_path(m), 0755); - - q = make_mount_point_inode_from_path(what, mount_entry_path(m), 0755); + q = mkdir_parents(mount_entry_path(m), 0755); if (q < 0 && q != -EEXIST) // FIXME: this shouldn't be logged at LOG_WARNING, but be bubbled up, and logged there to avoid duplicate logging - log_warning_errno(q, "Failed to create destination mount point node '%s', ignoring: %m", + log_warning_errno(q, "Failed to create parent directories of destination mount point node '%s', ignoring: %m", mount_entry_path(m)); - else - try_again = true; + else { + q = make_mount_point_inode_from_path(what, mount_entry_path(m), 0755); + if (q < 0 && q != -EEXIST) + // FIXME: this shouldn't be logged at LOG_WARNING, but be bubbled up, and logged there to avoid duplicate logging + log_warning_errno(q, "Failed to create destination mount point node '%s', ignoring: %m", + mount_entry_path(m)); + else + try_again = true; + } } if (try_again)