Merge pull request #9791 from poettering/user-runtime-dir-fixes

user-runtime-dir@.service fixes
This commit is contained in:
Zbigniew Jędrzejewski-Szmek 2018-08-03 13:32:01 +02:00 committed by GitHub
commit 72f6e560ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 8 deletions

View File

@ -95,20 +95,19 @@ static int user_remove_runtime_path(const char *runtime_path) {
r = rm_rf(runtime_path, 0); r = rm_rf(runtime_path, 0);
if (r < 0) if (r < 0)
log_error_errno(r, "Failed to remove runtime directory %s (before unmounting): %m", runtime_path); log_debug_errno(r, "Failed to remove runtime directory %s (before unmounting), ignoring: %m", runtime_path);
/* Ignore cases where the directory isn't mounted, as that's /* Ignore cases where the directory isn't mounted, as that's quite possible, if we lacked the permissions to
* quite possible, if we lacked the permissions to mount * mount something */
* something */
r = umount2(runtime_path, MNT_DETACH); r = umount2(runtime_path, MNT_DETACH);
if (r < 0 && !IN_SET(errno, EINVAL, ENOENT)) if (r < 0 && !IN_SET(errno, EINVAL, ENOENT))
log_error_errno(errno, "Failed to unmount user runtime directory %s: %m", runtime_path); log_debug_errno(errno, "Failed to unmount user runtime directory %s, ignoring: %m", runtime_path);
r = rm_rf(runtime_path, REMOVE_ROOT); r = rm_rf(runtime_path, REMOVE_ROOT);
if (r < 0) if (r < 0 && r != -ENOENT)
log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path); return log_error_errno(r, "Failed to remove runtime directory %s (after unmounting): %m", runtime_path);
return r; return 0;
} }
static int do_mount(const char *user) { static int do_mount(const char *user) {

View File

@ -10,9 +10,12 @@
[Unit] [Unit]
Description=/run/user/%i mount wrapper Description=/run/user/%i mount wrapper
Documentation=man:user@.service(5) Documentation=man:user@.service(5)
After=systemd-user-sessions.service
StopWhenUnneeded=yes StopWhenUnneeded=yes
[Service] [Service]
ExecStart=@rootlibexecdir@/systemd-user-runtime-dir start %i ExecStart=@rootlibexecdir@/systemd-user-runtime-dir start %i
ExecStop=@rootlibexecdir@/systemd-user-runtime-dir stop %i ExecStop=@rootlibexecdir@/systemd-user-runtime-dir stop %i
Type=oneshot
RemainAfterExit=true RemainAfterExit=true
Slice=user-%i.slice