From 8087660ccce2dc0ab5e813ebfa0acbc7646fc09f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 3 Nov 2026 18:18:55 +0100 Subject: [PATCH] shutdown: propagate correct error when remounting fails MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here the logging was fine, but the bogus r == -1 value was propagated as the return value. The parent then logged "Remounting '…' failed abnormally, child process … failed: Operation not permitted" whatever the real error was, and returned -EPERM. Do what umount_with_timeout() already does with umount2(). --- src/shutdown/umount.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c index 8bb647fe723..d32772a49dd 100644 --- a/src/shutdown/umount.c +++ b/src/shutdown/umount.c @@ -273,10 +273,10 @@ static int remount_with_timeout(MountPoint *m, bool last_try) { log_info("Remounting '%s' read-only with options '%s'.", m->path, strempty(m->remount_options)); /* Start the mount operation here in the child */ - r = mount(/* source= */ NULL, m->path, /* filesystemtype= */ NULL, m->remount_flags, m->remount_options); + r = RET_NERRNO(mount(/* source= */ NULL, m->path, /* filesystemtype= */ NULL, m->remount_flags, m->remount_options)); if (r < 0) log_full_errno(last_try ? LOG_ERR : LOG_INFO, - errno, + r, "Failed to remount '%s' read-only: %m", m->path);