summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSangjung Woo <sangjung.woo@samsung.com>2015-08-26 10:32:29 +0900
committerSangjung Woo <sangjung.woo@samsung.com>2015-08-26 10:32:29 +0900
commit9a36d09756c81588ac747766ce96f8f320619a62 (patch)
treea6c4702bd7b755b9d956a785fdab9c13cc010de2
parentdd050b2c84911c35e8bd8f0ddf6e0d20fd2d2c2b (diff)
downloadsystemd-9a36d09756c81588ac747766ce96f8f320619a62.tar.gz
systemd-9a36d09756c81588ac747766ce96f8f320619a62.tar.bz2
systemd-9a36d09756c81588ac747766ce96f8f320619a62.zip
When logging in and out continually, the below error occurs. * systemd: Failed at step CGROUP spawning /usr/lib/systemd/systemd: No such file or directory This is mainly because the cgroup path of systemd user session does not exists even though that cgroup is marked as 'realized'. That is definitely bug and it is already reported into systemd mainline last January. But there is no _right_ solution right now and it looks like a picky problem to resolve. So I made this patch as a workaround for Tizen TDC demonstration. Change-Id: Ie2e164a4e4daeb88fc102e5fa88e0faca28088b0 Signed-off-by: Sangjung Woo <sangjung.woo@samsung.com>
-rw-r--r--src/core/service.c13
-rw-r--r--src/shared/cgroup-util.c12
-rw-r--r--src/shared/cgroup-util.h2
3 files changed, 27 insertions, 0 deletions
diff --git a/src/core/service.c b/src/core/service.c
index 7781b4e626..f76ace3db8 100644
--- a/src/core/service.c
+++ b/src/core/service.c
@@ -1058,6 +1058,19 @@ static int service_spawn(
assert(c);
assert(_pid);
+
+ /* TODO workaround code */
+ if (UNIT(s)->cgroup_realized) {
+ _cleanup_free_ char *path = NULL;
+ path = unit_default_cgroup_path(UNIT(s));
+
+ if (cg_check_cgroup_exist(path) < 0) {
+ log_unit_error(UNIT(s)->id, "CGROUP ERROR! (%s) is already realized but not exists", UNIT(s)->id);
+ UNIT(s)->cgroup_realized = false;
+ UNIT(s)->cgroup_realized_mask = 0;
+ }
+ }
+
unit_realize_cgroup(UNIT(s));
r = unit_setup_exec_runtime(UNIT(s));
diff --git a/src/shared/cgroup-util.c b/src/shared/cgroup-util.c
index dfd8689b72..db76a88ea9 100644
--- a/src/shared/cgroup-util.c
+++ b/src/shared/cgroup-util.c
@@ -1794,3 +1794,15 @@ int cg_kernel_controllers(Set *controllers) {
return 0;
}
+
+int cg_check_cgroup_exist(const char *p) {
+ const char *cc;
+ assert(p);
+
+ cc = strjoina("/sys/fs/cgroup/systemd", p);
+ if (laccess(cc, F_OK) < 0) {
+ return -errno;
+ }
+
+ return 0;
+}
diff --git a/src/shared/cgroup-util.h b/src/shared/cgroup-util.h
index 96a3d3bafa..0fc6afa300 100644
--- a/src/shared/cgroup-util.h
+++ b/src/shared/cgroup-util.h
@@ -74,6 +74,8 @@ int cg_get_path_and_check(const char *controller, const char *path, const char *
int cg_pid_get_path(const char *controller, pid_t pid, char **path);
+int cg_check_cgroup_exist(const char *p);
+
int cg_trim(const char *controller, const char *path, bool delete_root);
int cg_rmdir(const char *controller, const char *path);