Thread (1 message) 1 message, 1 author, 2012-12-17
DORMANTno replies

[RFC PATCH 9/9] cgroup: rework cgroup_path

From: Gao feng <hidden>
Date: 2012-12-17 06:43:35
Subsystem: the rest · Maintainer: Linus Torvalds

use cgrp == cgrp->top_cgroup instead of cgrp == NULL

Signed-off-by: Gao feng <redacted>
---
 kernel/cgroup.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index b0caa1d..c111cf9 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -1976,12 +1976,14 @@ int cgroup_path(const struct cgroup *cgrp, char *buf, int buflen)
 		if ((start -= len) < buf)
 			return -ENAMETOOLONG;
 		memcpy(start, dentry->d_name.name, len);
-		cgrp = cgrp->parent;
-		if (!cgrp)
+
+		if (cgrp == cgrp->top_cgroup)
 			break;
 
+		cgrp = cgrp->parent;
 		dentry = cgrp->dentry;
-		if (!cgrp->parent)
+
+		if (cgrp == cgrp->top_cgroup)
 			continue;
 		if (--start < buf)
 			return -ENAMETOOLONG;
-- 
1.7.7.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help