From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1760859AbbBIPII (ORCPT ); Mon, 9 Feb 2015 10:08:08 -0500 Received: from smtprelay0137.hostedemail.com ([216.40.44.137]:45646 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1759789AbbBIPIH (ORCPT ); Mon, 9 Feb 2015 10:08:07 -0500 X-Session-Marker: 6E657665747340676F6F646D69732E6F7267 X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,rostedt@goodmis.org,:::::::::::,RULES_HIT:41:355:379:421:541:599:800:960:966:973:988:989:1260:1277:1311:1313:1314:1345:1359:1437:1515:1516:1518:1534:1542:1593:1594:1605:1711:1730:1747:1777:1792:1981:2194:2196:2199:2200:2393:2553:2559:2562:2693:3138:3139:3140:3141:3142:3622:3865:3866:3867:3868:3870:3871:3872:3874:4362:4385:5007:6261:7875:7903:8660:9163:10004:10400:10848:10967:11026:11232:11658:11914:12043:12438:12517:12519:12740:13148:13230:14096:14097:21080,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:fn,MSBL:0,DNSBL:none,Custom_rules:0:0:0 X-HE-Tag: truck64_45cb4f1d9d35e X-Filterd-Recvd-Size: 3565 Date: Mon, 9 Feb 2015 10:07:58 -0500 From: Steven Rostedt To: Namhyung Kim Cc: linux-kernel@vger.kernel.org, Al Viro , Greg Kroah-Hartman , Ingo Molnar , Andrew Morton Subject: Re: [for-next][PATCH 7/7] tracing: Have mkdir and rmdir be part of tracefs Message-ID: <20150209100758.05b6217c@gandalf.local.home> In-Reply-To: <20150209060722.GC30788@sejong> References: <20150204143420.290584004@goodmis.org> <20150204143756.006343748@goodmis.org> <20150209060722.GC30788@sejong> X-Mailer: Claws Mail 3.11.1 (GTK+ 2.24.25; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 9 Feb 2015 15:07:22 +0900 Namhyung Kim wrote: > On Wed, Feb 04, 2015 at 09:34:27AM -0500, Steven Rostedt wrote: > > +static int tracefs_syscall_mkdir(struct inode *inode, struct dentry *dentry, umode_t mode) > > +{ > > + char *name; > > + int ret; > > + > > + name = get_dname(dentry); > > + if (!name) > > + return -ENOMEM; > > + > > + /* > > + * The mkdir call can call the generic functions that create > > The mkdir can call ... ? Actually, that wasn't a typo. "mkdir call" is the subject. > > > > + * the files within the tracefs system. It is up to the individual > > + * mkdir routine to handle races. > > + */ > > + mutex_unlock(&inode->i_mutex); > > + ret = tracefs_ops.mkdir(name); > > + mutex_lock(&inode->i_mutex); > > + > > + kfree(name); > > + > > + return ret; > > +} > > + > > +static int tracefs_syscall_rmdir(struct inode *inode, struct dentry *dentry) > > +{ > > + char *name; > > + int ret; > > + > > + name = get_dname(dentry); > > + if (!name) > > + return -ENOMEM; > > + > > + /* > > + * The rmdir call can call the generic functions that create > > Ditto. > "rmdir call" is also the subject. > > > + * the files within the tracefs system. It is up to the individual > > + * rmdir routine to handle races. > > + * This time we need to unlock not only the parent (inode) but > > + * also the directory that is being deleted. > > + */ > > + mutex_unlock(&inode->i_mutex); > > + mutex_unlock(&dentry->d_inode->i_mutex); > > + > > + ret = tracefs_ops.rmdir(name); > > + > > + mutex_lock_nested(&inode->i_mutex, I_MUTEX_PARENT); > > + mutex_lock(&dentry->d_inode->i_mutex); > > + > > + kfree(name); > > + > > + return ret; > > +} > > + > > [SNIP] > > +/** > > + * tracefs_create_instance_dir - create the tracing instances directory > > + * @name: The name of the instances directory to create > > + * @parent: The parent directory that the instances directory will exist > > + * @mkdir: The function to call when a mkdir is performed. > > + * @rmdir: The function to call when a rmdir is performed. > > + * > > + * Only one instances directory is allowed. > > + * > > + * The instances directory is special as it allows for mkdir and rmdir to > > + * to be done by userspace. When a mkdir or rmdir is performed, the inode > > + * locks are released and the methhods passed in (@mkdir and @rmdir) are > > s/methhods/methods/ I must have been on meth ;-) Thanks. -- Steve