* [PATCH] cgroup_rm_file: don't delete the uncreated files
@ 2012-12-06 3:09 Gao feng
[not found] ` <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
0 siblings, 1 reply; 4+ messages in thread
From: Gao feng @ 2012-12-06 3:09 UTC (permalink / raw)
To: tj-DgEjT+Ai2ygdnm+yROfE0A
Cc: lizefan-hv44wF8Li93QT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA,
containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Gao feng
in cgroup_add_file,when creating files for cgroup,
some of creation may be skipped. So we need to avoid
deleting these uncreated files in cgroup_rm_file,
otherwise the warning msg will be triggered.
"cgroup_addrm_files: failed to remove memory_pressure_enabled, err=-2"
Signed-off-by: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
---
kernel/cgroup.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 5cc3724..6928b3e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -932,6 +932,12 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft)
lockdep_assert_held(&cgrp->dentry->d_inode->i_mutex);
lockdep_assert_held(&cgroup_mutex);
+ /* does @cft->flags tell us this file isn't created on @cgrp? */
+ if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent)
+ return 0;
+ if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent)
+ return 0;
+
list_for_each_entry(cfe, &cgrp->files, node) {
struct dentry *d = cfe->dentry;
--
1.7.7.6
^ permalink raw reply related [flat|nested] 4+ messages in thread[parent not found: <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>]
* Re: [PATCH] cgroup_rm_file: don't delete the uncreated files [not found] ` <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> @ 2012-12-06 6:01 ` Gao feng 2012-12-06 6:02 ` Li Zefan 1 sibling, 0 replies; 4+ messages in thread From: Gao feng @ 2012-12-06 6:01 UTC (permalink / raw) To: Gao feng Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, lizefan-hv44wF8Li93QT0dZR+AlfA, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA on 2012/12/06 11:09, Gao feng wrote: > in cgroup_add_file,when creating files for cgroup, > some of creation may be skipped. So we need to avoid > deleting these uncreated files in cgroup_rm_file, > otherwise the warning msg will be triggered. > > "cgroup_addrm_files: failed to remove memory_pressure_enabled, err=-2" > > Signed-off-by: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> > --- > kernel/cgroup.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index 5cc3724..6928b3e 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -932,6 +932,12 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) oops,cft may be NULL,I miss the check of cft in this patch. Please ignore this patch,I will resent it. ^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] cgroup_rm_file: don't delete the uncreated files [not found] ` <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> 2012-12-06 6:01 ` Gao feng @ 2012-12-06 6:02 ` Li Zefan [not found] ` <50C03505.3070801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> 1 sibling, 1 reply; 4+ messages in thread From: Li Zefan @ 2012-12-06 6:02 UTC (permalink / raw) To: Gao feng Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA On 2012/12/6 11:09, Gao feng wrote: > in cgroup_add_file,when creating files for cgroup, > some of creation may be skipped. So we need to avoid > deleting these uncreated files in cgroup_rm_file, > otherwise the warning msg will be triggered. > > "cgroup_addrm_files: failed to remove memory_pressure_enabled, err=-2" > > Signed-off-by: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> > --- > kernel/cgroup.c | 6 ++++++ > 1 files changed, 6 insertions(+), 0 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index 5cc3724..6928b3e 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -932,6 +932,12 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) > lockdep_assert_held(&cgrp->dentry->d_inode->i_mutex); > lockdep_assert_held(&cgroup_mutex); > > + /* does @cft->flags tell us this file isn't created on @cgrp? */ > + if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent) > + return 0; > + if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent) > + return 0; > + We should move those checks to cgroup_addrm_files() to avoid code duplication. > list_for_each_entry(cfe, &cgrp->files, node) { > struct dentry *d = cfe->dentry; > > ^ permalink raw reply [flat|nested] 4+ messages in thread
[parent not found: <50C03505.3070801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>]
* Re: [PATCH] cgroup_rm_file: don't delete the uncreated files [not found] ` <50C03505.3070801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org> @ 2012-12-06 6:12 ` Gao feng 0 siblings, 0 replies; 4+ messages in thread From: Gao feng @ 2012-12-06 6:12 UTC (permalink / raw) To: Li Zefan Cc: tj-DgEjT+Ai2ygdnm+yROfE0A, cgroups-u79uwXL29TY76Z2rM5mHXA, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA 于 2012年12月06日 14:02, Li Zefan 写道: > On 2012/12/6 11:09, Gao feng wrote: >> in cgroup_add_file,when creating files for cgroup, >> some of creation may be skipped. So we need to avoid >> deleting these uncreated files in cgroup_rm_file, >> otherwise the warning msg will be triggered. >> >> "cgroup_addrm_files: failed to remove memory_pressure_enabled, err=-2" >> >> Signed-off-by: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org> >> --- >> kernel/cgroup.c | 6 ++++++ >> 1 files changed, 6 insertions(+), 0 deletions(-) >> >> diff --git a/kernel/cgroup.c b/kernel/cgroup.c >> index 5cc3724..6928b3e 100644 >> --- a/kernel/cgroup.c >> +++ b/kernel/cgroup.c >> @@ -932,6 +932,12 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) >> lockdep_assert_held(&cgrp->dentry->d_inode->i_mutex); >> lockdep_assert_held(&cgroup_mutex); >> >> + /* does @cft->flags tell us this file isn't created on @cgrp? */ >> + if ((cft->flags & CFTYPE_NOT_ON_ROOT) && !cgrp->parent) >> + return 0; >> + if ((cft->flags & CFTYPE_ONLY_ON_ROOT) && cgrp->parent) >> + return 0; >> + > > We should move those checks to cgroup_addrm_files() to avoid code duplication. > Get it,and the null check of cft in cgroup_rm_file is no need too. Thanks! ^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2012-12-06 6:12 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-06 3:09 [PATCH] cgroup_rm_file: don't delete the uncreated files Gao feng
[not found] ` <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-12-06 6:01 ` Gao feng
2012-12-06 6:02 ` Li Zefan
[not found] ` <50C03505.3070801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-12-06 6:12 ` Gao feng
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).