From mboxrd@z Thu Jan 1 00:00:00 1970 From: Li Zefan Subject: Re: [PATCH] cgroup: superblock can't be released with active dentries Date: Mon, 28 May 2012 08:18:08 +0800 Message-ID: <4FC2C440.8090104@huawei.com> References: <20120330223423.GJ28934@google.com> <20120330223606.GK28934@google.com> <4F77B6BA.4070207@huawei.com> <20120401185430.GA9230@dhcp-172-17-108-109.mtv.corp.google.com> <20120518175548.GM19388@google.com> <20120523222242.GD3933@htj.dyndns.org> <20120524154139.GA27983@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-reply-to: <20120524154139.GA27983-hpIqsD4AKlfQT0dZR+AlfA@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: Tejun Heo 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, Michal Hocko , Sasha Levin , Johannes Weiner , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Vivek Goyal 2012/5/24 23:41, Tejun Heo wrote: >>>From 88787c483106c5830a46d18deaffdc1e70929af7 Mon Sep 17 00:00:00 2001 > From: Tejun Heo > Date: Thu, 24 May 2012 08:24:39 -0700 > > 48ddbe1946 "cgroup: make css->refcnt clearing on cgroup removal > optional" allowed a css to linger after the associated cgroup is > removed. As a css holds a reference on the cgroup's dentry, it means > that cgroup dentries may linger for a while. > > cgroup_create() does grab an active reference on the superblock to > prevent it from going away while there are !root cgroups; however, the > reference is put from cgroup_diput() which is invoked on cgroup > removal, so cgroup dentries which are removed but persisting due to > lingering csses already have released their superblock active refs > allowing superblock to be killed while those dentries are around. > > Given the right condition, this makes cgroup_kill_sb() call > kill_litter_super() with dentries with non-zero d_count leading to > BUG() in shrink_dcache_for_umount_subtree(). > > Fix it by adding cgroup_dops->d_release() operation and moving > deactivate_super() to it. cgroup_diput() now marks dentry->d_fsdata > with itself if superblock should be deactivated and cgroup_d_release() > deactivates the superblock on dentry release. > > Signed-off-by: Tejun Heo > Reported-by: Sasha Levin > Tested-by: Sasha Levin > LKML-Reference: Acked-by: Li Zefan From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752568Ab2E1ASZ (ORCPT ); Sun, 27 May 2012 20:18:25 -0400 Received: from szxga04-in.huawei.com ([58.251.152.67]:51214 "EHLO szxga04-in.huawei.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1751797Ab2E1ASU (ORCPT ); Sun, 27 May 2012 20:18:20 -0400 Date: Mon, 28 May 2012 08:18:08 +0800 From: Li Zefan Subject: Re: [PATCH] cgroup: superblock can't be released with active dentries In-reply-to: <20120524154139.GA27983@google.com> X-Originating-IP: [10.166.88.128] To: Tejun Heo Cc: Sasha Levin , containers@lists.linux-foundation.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, fweisbec@gmail.com, rni@google.com, ctalbott@google.com, Vivek Goyal , Johannes Weiner , Michal Hocko , Balbir Singh , KAMEZAWA Hiroyuki Message-id: <4FC2C440.8090104@huawei.com> MIME-version: 1.0 Content-type: text/plain; charset=ISO-8859-1 Content-transfer-encoding: 7BIT User-Agent: Mozilla/5.0 (Windows NT 6.1; rv:11.0) Gecko/20120312 Thunderbird/11.0 X-CFilter-Loop: Reflected References: <20120330223423.GJ28934@google.com> <20120330223606.GK28934@google.com> <4F77B6BA.4070207@huawei.com> <20120401185430.GA9230@dhcp-172-17-108-109.mtv.corp.google.com> <20120518175548.GM19388@google.com> <20120523222242.GD3933@htj.dyndns.org> <20120524154139.GA27983@google.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 2012/5/24 23:41, Tejun Heo wrote: >>>From 88787c483106c5830a46d18deaffdc1e70929af7 Mon Sep 17 00:00:00 2001 > From: Tejun Heo > Date: Thu, 24 May 2012 08:24:39 -0700 > > 48ddbe1946 "cgroup: make css->refcnt clearing on cgroup removal > optional" allowed a css to linger after the associated cgroup is > removed. As a css holds a reference on the cgroup's dentry, it means > that cgroup dentries may linger for a while. > > cgroup_create() does grab an active reference on the superblock to > prevent it from going away while there are !root cgroups; however, the > reference is put from cgroup_diput() which is invoked on cgroup > removal, so cgroup dentries which are removed but persisting due to > lingering csses already have released their superblock active refs > allowing superblock to be killed while those dentries are around. > > Given the right condition, this makes cgroup_kill_sb() call > kill_litter_super() with dentries with non-zero d_count leading to > BUG() in shrink_dcache_for_umount_subtree(). > > Fix it by adding cgroup_dops->d_release() operation and moving > deactivate_super() to it. cgroup_diput() now marks dentry->d_fsdata > with itself if superblock should be deactivated and cgroup_d_release() > deactivates the superblock on dentry release. > > Signed-off-by: Tejun Heo > Reported-by: Sasha Levin > Tested-by: Sasha Levin > LKML-Reference: Acked-by: Li Zefan