From: Lennart Poettering Date: Wed, 21 Feb 2018 22:57:21 +0000 (+0100) Subject: umount: beef up logging when umount/remount child processes fail X-Git-Tag: v238~74^2~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=00adeed99f593926833da32aeb55a2e619fe3024;p=thirdparty%2Fsystemd.git umount: beef up logging when umount/remount child processes fail Let's extend what we log if umount/remount doesn't work correctly as we expect. See #8155 --- diff --git a/src/core/umount.c b/src/core/umount.c index 731436af27c..fa9c15ca367 100644 --- a/src/core/umount.c +++ b/src/core/umount.c @@ -406,10 +406,12 @@ static int remount_with_timeout(MountPoint *m, char *options, int *n_failed) { r = wait_for_terminate_with_timeout(pid, DEFAULT_TIMEOUT_USEC); if (r == -ETIMEDOUT) { - log_error_errno(errno, "Remounting '%s' - timed out, issuing SIGKILL to PID "PID_FMT".", m->path, pid); + log_error_errno(r, "Remounting '%s' timed out, issuing SIGKILL to PID " PID_FMT ".", m->path, pid); (void) kill(pid, SIGKILL); - } else if (r < 0) - log_error_errno(r, "Failed to wait for process: %m"); + } else if (r == -EPROTO) + log_error_errno(r, "Remounting '%s' failed abnormally, child process " PID_FMT " aborted or exited non-zero.", m->path, pid); + else if (r < 0) + log_error_errno(r, "Remounting '%s' failed unexpectedly, couldn't wait for child process " PID_FMT ": %m", m->path, pid); return r; } @@ -446,10 +448,12 @@ static int umount_with_timeout(MountPoint *m, bool *changed) { r = wait_for_terminate_with_timeout(pid, DEFAULT_TIMEOUT_USEC); if (r == -ETIMEDOUT) { - log_error_errno(errno, "Unmounting '%s' - timed out, issuing SIGKILL to PID "PID_FMT".", m->path, pid); + log_error_errno(r, "Unmounting '%s' timed out, issuing SIGKILL to PID " PID_FMT ".", m->path, pid); (void) kill(pid, SIGKILL); - } else if (r < 0) - log_error_errno(r, "Failed to wait for process: %m"); + } else if (r == -EPROTO) + log_error_errno(r, "Unmounting '%s' failed abnormally, child process " PID_FMT " aborted or exited non-zero.", m->path, pid); + else if (r < 0) + log_error_errno(r, "Unmounting '%s' failed unexpectedly, couldn't wait for child process " PID_FMT ": %m", m->path, pid); return r; }