add error message when bind mount src missing

This commit is contained in:
Alan Perry 2020-06-26 05:37:39 +00:00 committed by Zbigniew Jędrzejewski-Szmek
parent 2b0bf3ccf8
commit 5dc60faae5
2 changed files with 8 additions and 5 deletions

View File

@ -1017,8 +1017,11 @@ static void mount_enter_mounting(Mount *m) {
/* Create the source directory for bind-mounts if needed */
p = get_mount_parameters_fragment(m);
if (p && mount_is_bind(p))
(void) mkdir_p_label(p->what, m->directory_mode);
if (p && mount_is_bind(p)) {
r = mkdir_p_label(p->what, m->directory_mode);
if (r < 0)
log_unit_error_errno(UNIT(m), r, "Failed to make bind mount source '%s': %m", p->what);
}
if (p) {
_cleanup_free_ char *opts = NULL;

View File

@ -1034,7 +1034,7 @@ static int apply_mount(
/* Hmm, either the source or the destination are missing. Let's see if we can create the destination, then try again */
if (stat(what, &st) < 0)
log_debug_errno(errno, "Mount point source '%s' is not accessible: %m", what);
log_error_errno(errno, "Mount point source '%s' is not accessible: %m", what);
else {
int q;
@ -1046,7 +1046,7 @@ static int apply_mount(
q = touch(mount_entry_path(m));
if (q < 0)
log_debug_errno(q, "Failed to create destination mount point node '%s': %m", mount_entry_path(m));
log_error_errno(q, "Failed to create destination mount point node '%s': %m", mount_entry_path(m));
else
try_again = true;
}
@ -1060,7 +1060,7 @@ static int apply_mount(
}
if (r < 0)
return log_debug_errno(r, "Failed to mount %s to %s: %m", what, mount_entry_path(m));
return log_error_errno(r, "Failed to mount %s to %s: %m", what, mount_entry_path(m));
}
log_debug("Successfully mounted %s to %s", what, mount_entry_path(m));