Commit 891f6f90 authored by Michael Biebl's avatar Michael Biebl
Browse files

Don't overmount existing /run/user/<UID> directories with a per-user tmpfs on upgrades

Closes: #762041
parent 81571027
...@@ -12,6 +12,10 @@ systemd (215-5) UNRELEASED; urgency=medium ...@@ -12,6 +12,10 @@ systemd (215-5) UNRELEASED; urgency=medium
reloads of services is requested before systemd is re-execed reloads of services is requested before systemd is re-execed
(Closes: #762146) (Closes: #762146)
[ Michael Biebl ]
* Don't overmount existing /run/user/<UID> directories with a per-user tmpfs
on upgrades. (Closes: #762041)
-- Sjoerd Simons <sjoerd@debian.org> Thu, 25 Sep 2014 22:13:42 +0200 -- Sjoerd Simons <sjoerd@debian.org> Thu, 25 Sep 2014 22:13:42 +0200
systemd (215-4) unstable; urgency=medium systemd (215-4) unstable; urgency=medium
......
From: Michael Biebl <biebl@debian.org>
Date: Sat, 27 Sep 2014 04:04:32 +0200
Subject: login: don't overmount /run/user/<UID> on upgrades
Since v215, logind uses a per-user tmpfs for $XDG_RUNTIME_DIR. When
upgrading from older versions, we don't want to overmount existing user
data, so if that directory already exists, we skip the step where we
mount the per-user tmpfs.
This patch is only necessary for upgrades from pre v215 versions and
should be removed in jessie+1.
Closes: #762041
---
src/login/logind-user.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/src/login/logind-user.c b/src/login/logind-user.c
index fdbccb3..2f29905 100644
--- a/src/login/logind-user.c
+++ b/src/login/logind-user.c
@@ -20,6 +20,7 @@
***/
#include <sys/mount.h>
+#include <sys/stat.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
@@ -305,6 +306,7 @@ int user_load(User *u) {
static int user_mkdir_runtime_path(User *u) {
char *p;
int r;
+ struct stat sb;
assert(u);
@@ -320,6 +322,12 @@ static int user_mkdir_runtime_path(User *u) {
} else
p = u->runtime_path;
+ /* If the directory already exists, don't mount a tmpfs over it */
+ if (stat(p, &sb) == 0 && S_ISDIR(sb.st_mode)) {
+ u->runtime_path = p;
+ return 0;
+ }
+
if (path_is_mount_point(p, false) <= 0) {
_cleanup_free_ char *t = NULL;
@@ -506,7 +514,7 @@ static int user_remove_runtime_path(User *u) {
if (r < 0)
log_error("Failed to remove runtime directory %s: %s", u->runtime_path, strerror(-r));
- if (umount2(u->runtime_path, MNT_DETACH) < 0)
+ if (path_is_mount_point(u->runtime_path, false) && umount2(u->runtime_path, MNT_DETACH) < 0)
log_error("Failed to unmount user runtime directory %s: %m", u->runtime_path);
r = rm_rf(u->runtime_path, false, true, false);
...@@ -153,3 +153,4 @@ Include-additional-directories-in-ProtectSystem.patch ...@@ -153,3 +153,4 @@ Include-additional-directories-in-ProtectSystem.patch
Fix-paths-in-man-pages.patch Fix-paths-in-man-pages.patch
buildsys-Don-t-default-to-gold-as-the-linker.patch buildsys-Don-t-default-to-gold-as-the-linker.patch
sd-bus-Accept-no-sender-as-the-destination-field.patch sd-bus-Accept-no-sender-as-the-destination-field.patch
login-don-t-overmount-run-user-UID-on-upgrades.patch
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment