mount: Log when we can't create the mount point

Debugging mount unit failures caused by systemd not being able to
create the mount point is currently rather hard. Let's log about
failures to create mount points to simplify debugging.
This commit is contained in:
Daan De Meyer
2023-10-02 11:24:03 +09:00
committed by Yu Watanabe
parent 185e201690
commit ce427d0e73
+4 -2
View File
@@ -1169,9 +1169,11 @@ static void mount_enter_mounting(Mount *m) {
}
if (source_is_dir)
(void) mkdir_p_label(m->where, m->directory_mode);
r = mkdir_p_label(m->where, m->directory_mode);
else
(void) touch_file(m->where, /* parents = */ true, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
r = touch_file(m->where, /* parents = */ true, USEC_INFINITY, UID_INVALID, GID_INVALID, MODE_INVALID);
if (r < 0 && r != -EEXIST)
log_unit_warning_errno(UNIT(m), r, "Failed to create mount point '%s', ignoring: %m", m->where);
if (source_is_dir)
unit_warn_if_dir_nonempty(UNIT(m), m->where);