cgroups.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Li Zefan <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
To: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Cc: tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
Subject: Re: [PATCH] cgroup_rm_file: don't delete the uncreated files
Date: Thu, 6 Dec 2012 14:02:45 +0800	[thread overview]
Message-ID: <50C03505.3070801@huawei.com> (raw)
In-Reply-To: <1354763350-3139-1-git-send-email-gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>

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;
>  
> 

  parent reply	other threads:[~2012-12-06  6:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
     [not found]     ` <50C03505.3070801-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2012-12-06  6:12       ` Gao feng

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50C03505.3070801@huawei.com \
    --to=lizefan-hv44wf8li93qt0dzr+alfa@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org \
    --cc=tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).