Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753723AbbFJFAQ (ORCPT ); Wed, 10 Jun 2015 01:00:16 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:3664 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751000AbbFJFAJ (ORCPT ); Wed, 10 Jun 2015 01:00:09 -0400 From: Lisa Du To: "gregkh@linuxfoundation.org" CC: "linux-kernel@vger.kernel.org" Subject: RE: A race condition between debugfs and seq_file operation Thread-Topic: A race condition between debugfs and seq_file operation Thread-Index: AQHQoaOGA0gdqb5zJkWNmEry1J5dT52lI+0AgAAL0fA= Date: Wed, 10 Jun 2015 05:00:03 +0000 Message-ID: <9473dc801fb245ea8df91da31d426f7f@SC-EXCH04.marvell.com> References: <3626bdb18cfc40c98618d0ee68816ab0@SC-EXCH04.marvell.com> <20150609211202.GA16801@kroah.com> In-Reply-To: <20150609211202.GA16801@kroah.com> Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-exchange-transport-fromentityheader: Hosted x-originating-ip: [10.93.176.43] Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.14.151,1.0.33,0.0.0000 definitions=2015-06-10_02:2015-06-09,2015-06-10,1970-01-01 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1402240000 definitions=main-1506100089 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by nfs id t5A50Loc000565 Content-Length: 1453 Lines: 40 > -----Original Message----- > From: gregkh@linuxfoundation.org [mailto:gregkh@linuxfoundation.org] > Sent: 2015??6??10?? 5:12 > To: Lisa Du > Cc: linux-kernel@vger.kernel.org > Subject: Re: A race condition between debugfs and seq_file operation > > On Mon, Jun 08, 2015 at 04:28:10AM +0000, Lisa Du wrote: > > Hi, All > > Recently I met one race condition related to debugfs. > > > > Take an example from ion.c in kernel3.14: > > static int ion_debug_client_open(struct inode *inode, struct file > > *file) { > > return single_open(file, ion_debug_client_show, inode->i_private); } > > > > static const struct file_operations debug_client_fops = { > > .open = ion_debug_client_open, > > .read = seq_read, > > .llseek = seq_lseek, > > .release = single_release, > > }; > > client->debug_root = debugfs_create_file(client->display_name, 0664, > > dev->clients_debug_root, > > client, &debug_client_fops); > > > > I find during I read the debugfs node, driver can do > > debugfs_remove_recursive(dentry); Is it expected? > > Yes. Well, not "expected", but a mess, yes. > > Removing debugfs files are known to have lots of races, this isn't the only > one :( Thanks for the reply! Not sure if there is any plan to resolve such races in the future? > > thanks, > > greg k-h ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?