]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
umount: beef up logging when umount/remount child processes fail
authorLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2018 22:57:21 +0000 (23:57 +0100)
committerLennart Poettering <lennart@poettering.net>
Wed, 21 Feb 2018 22:57:21 +0000 (23:57 +0100)
Let's extend what we log if umount/remount doesn't work correctly as we
expect.

See #8155

src/core/umount.c

index 731436af27ca03a0bbc08e1aa9c5ee911b929044..fa9c15ca36764721bd12bd90012c3099bc06d047 100644 (file)
@@ -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;
 }