From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tejun Heo Subject: Re: [PATCH 09/10] cgroup: introduce struct cfent Date: Tue, 20 Mar 2012 09:49:15 -0700 Message-ID: <20120320164915.GF5684@google.com> References: <1331940963-15756-1-git-send-email-tj@kernel.org> <1331940963-15756-10-git-send-email-tj@kernel.org> <4F688EA9.8050905@parallels.com> <20120320160228.GD5684@google.com> <4F68AA37.80604@parallels.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=veOoPssOPTd3vqtgZC7j9ePrfo1kbB/h8l/+67ltvvo=; b=u3RsJKsE5o5ICVO3zmEs0tsBNwuJu2tMtvm+KJEugaZ3+TXp39bLt+Sr3T1neJcNgW Dqbowt5AC8BQZrsyNkTn/KAqXsjjIamXop9drJ1BqUKBIepoDPP89aZTJCFgckB/1aif vMm5mlGUX2B55ibrOqj1SI8r00qTmpUgjDsgUdK7+E+GxRF8ItBe0UXRxL0S6FCyoydJ Kxu3Fgh6VyZsz92FoN+r8sFbxm6+aVn2OmIC9WBV7uN7pOLXJGrZnvpRPxJ5DXKXaTwe 4Q080UI9kQmshn5464B97AjwJ/TUebYLZDBKzYFKowFm4KNYKmvpy4+inVfYIWts/s0Z PTJQ== Content-Disposition: inline In-Reply-To: <4F68AA37.80604-bzQdu9zFT3WakBO8gow8eQ@public.gmane.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Glauber Costa Cc: ctalbott-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, rni-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, fweisbec-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org On Tue, Mar 20, 2012 at 08:03:03PM +0400, Glauber Costa wrote: > From 04604201411ab0a14fa1447072cd1b273d0774ed Mon Sep 17 00:00:00 2001 > From: Glauber Costa > Date: Tue, 20 Mar 2012 18:12:55 +0400 > Subject: [PATCH] don't trigger warning when d_subdirs is not empty. > > It is never empty at this point, because of the self references. > a better test is to see if any of them gets d_inode set. > > Signed-off-by: Glauber Costa > Signed-off-by: Tejun Heo > --- > kernel/cgroup.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index cf7b298..b45a653 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -947,10 +947,16 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) > static void cgroup_clear_directory(struct dentry *dir) > { > struct cgroup *cgrp = __d_cgrp(dir); > + struct list_head *child; > > while (!list_empty(&cgrp->files)) > cgroup_rm_file(cgrp, NULL); > - WARN_ON_ONCE(!list_empty(&dir->d_subdirs)); > + > + list_for_each(child, &dir->d_subdirs) { > + struct dentry *d; > + d = list_entry(child, struct dentry, d_u.d_child); > + WARN_ON_ONCE(d->d_inode); > + } This seems correct and I'll apply this but I still can't reproduce the warning at will before the patch. How do I a get negative dentry on the d_subdirs when d_delete always returns 1? Glauber, can you trigger the warning at will? Thanks. -- tejun From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755793Ab2CTQtW (ORCPT ); Tue, 20 Mar 2012 12:49:22 -0400 Received: from mail-pz0-f46.google.com ([209.85.210.46]:43939 "EHLO mail-pz0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753062Ab2CTQtU (ORCPT ); Tue, 20 Mar 2012 12:49:20 -0400 Date: Tue, 20 Mar 2012 09:49:15 -0700 From: Tejun Heo To: Glauber Costa Cc: lizf@cn.fujitsu.com, containers@lists.linux-foundation.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, rni@google.com, ctalbott@google.com Subject: Re: [PATCH 09/10] cgroup: introduce struct cfent Message-ID: <20120320164915.GF5684@google.com> References: <1331940963-15756-1-git-send-email-tj@kernel.org> <1331940963-15756-10-git-send-email-tj@kernel.org> <4F688EA9.8050905@parallels.com> <20120320160228.GD5684@google.com> <4F68AA37.80604@parallels.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4F68AA37.80604@parallels.com> User-Agent: Mutt/1.5.20 (2009-06-14) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 20, 2012 at 08:03:03PM +0400, Glauber Costa wrote: > From 04604201411ab0a14fa1447072cd1b273d0774ed Mon Sep 17 00:00:00 2001 > From: Glauber Costa > Date: Tue, 20 Mar 2012 18:12:55 +0400 > Subject: [PATCH] don't trigger warning when d_subdirs is not empty. > > It is never empty at this point, because of the self references. > a better test is to see if any of them gets d_inode set. > > Signed-off-by: Glauber Costa > Signed-off-by: Tejun Heo > --- > kernel/cgroup.c | 8 +++++++- > 1 files changed, 7 insertions(+), 1 deletions(-) > > diff --git a/kernel/cgroup.c b/kernel/cgroup.c > index cf7b298..b45a653 100644 > --- a/kernel/cgroup.c > +++ b/kernel/cgroup.c > @@ -947,10 +947,16 @@ static int cgroup_rm_file(struct cgroup *cgrp, const struct cftype *cft) > static void cgroup_clear_directory(struct dentry *dir) > { > struct cgroup *cgrp = __d_cgrp(dir); > + struct list_head *child; > > while (!list_empty(&cgrp->files)) > cgroup_rm_file(cgrp, NULL); > - WARN_ON_ONCE(!list_empty(&dir->d_subdirs)); > + > + list_for_each(child, &dir->d_subdirs) { > + struct dentry *d; > + d = list_entry(child, struct dentry, d_u.d_child); > + WARN_ON_ONCE(d->d_inode); > + } This seems correct and I'll apply this but I still can't reproduce the warning at will before the patch. How do I a get negative dentry on the d_subdirs when d_delete always returns 1? Glauber, can you trigger the warning at will? Thanks. -- tejun