From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752266AbbKGHnh (ORCPT ); Sat, 7 Nov 2015 02:43:37 -0500 Received: from szxga01-in.huawei.com ([58.251.152.64]:17034 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751652AbbKGHnf (ORCPT ); Sat, 7 Nov 2015 02:43:35 -0500 Subject: Re: [PATCH cgroup/for-4.4-fixes] cgroup: fix cftype->file_offset handling To: Tejun Heo , Johannes Weiner References: <20151105051224.GA4914@htj.duckdns.org> CC: , , James Sedgwick , From: Zefan Li Message-ID: <563DAB7F.7020407@huawei.com> Date: Sat, 7 Nov 2015 15:42:55 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 MIME-Version: 1.0 In-Reply-To: <20151105051224.GA4914@htj.duckdns.org> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.177.19.236] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090205.563DAB8D.0026,ss=1,re=0.000,fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2011-05-27 18:58:46 X-Mirapoint-Loop-Id: b3551af7ce15bb2f87c86059ede11ec1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2015/11/5 13:12, Tejun Heo wrote: > 6f60eade2433 ("cgroup: generalize obtaining the handles of and > notifying cgroup files") introduced cftype->file_offset so that the > handles for per-css file instances can be recorded. These handles > then can be used, for example, to generate file modified > notifications. > > Unfortunately, it made the wrong assumption that files are created > once for a given css and removed on its destruction. Due to the > dependencies among subsystems, a css may be hidden from userland and > then later shown again. This is implemented by removing and > re-creating the affected files, so the associated kernfs_node for a > given cgroup file may change over time. This incorrect assumption led > to the corruption of css->files lists. > > Reimplement cftype->file_offset handling so that cgroup_file->kn is > protected by a lock and updated as files are created and destroyed. > This also makes keeping them on per-cgroup list unnecessary. > > Signed-off-by: Tejun Heo > Reported-by: James Sedgwick > Fixes: 6f60eade2433 ("cgroup: generalize obtaining the handles of and notifying cgroup files") Acked-by: Zefan Li