From: Herbert Poetzl Subject: Re: [RFC][PATCH 02/27] vfs_rmdir: change if() into goto Date: Thu, 8 Jun 2006 12:37:57 +0200 Message-ID: <20060608103757.GB11996@MAIL.13thfloor.at> References: <20060608001013.0D041507@localhost.localdomain> <20060608001015.CBE0A7A8@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, viro@ftp.linux.org.uk, hch@infradead.org, trond.myklebust@fys.uio.no Return-path: Received: from MAIL.13thfloor.at ([212.16.62.50]:19848 "EHLO mail.13thfloor.at") by vger.kernel.org with ESMTP id S964775AbWFHKh6 (ORCPT ); Thu, 8 Jun 2006 06:37:58 -0400 To: Dave Hansen Content-Disposition: inline In-Reply-To: <20060608001015.CBE0A7A8@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Jun 07, 2006 at 05:10:15PM -0700, Dave Hansen wrote: > > We're going to add another condition here in a minute, so > add a goto instead of an if. > > There will be a lot of patches like this one. They may seem > too finely-grained, but I did encounter a couple of bugs where > I botched one of these. If there is a bug in one, this level > of granularity will really help to track them down with a > chop-search. Acked-by: Herbert Poetzl > Signed-off-by: Dave Hansen > --- > > lxc-dave/fs/namei.c | 9 +++++---- > 1 files changed, 5 insertions(+), 4 deletions(-) > > diff -puN fs/namei.c~rmdir fs/namei.c > --- lxc/fs/namei.c~rmdir 2006-06-07 16:53:12.000000000 -0700 > +++ lxc-dave/fs/namei.c 2006-06-07 16:53:12.000000000 -0700 > @@ -2010,10 +2010,11 @@ static long do_rmdir(int dfd, const char > mutex_lock_nested(&nd.dentry->d_inode->i_mutex, I_MUTEX_PARENT); > dentry = lookup_hash(&nd); > error = PTR_ERR(dentry); > - if (!IS_ERR(dentry)) { > - error = vfs_rmdir(nd.dentry->d_inode, dentry); > - dput(dentry); > - } > + if (IS_ERR(dentry)) > + goto exit2; > + error = vfs_rmdir(nd.dentry->d_inode, dentry); > + dput(dentry); > +exit2: > mutex_unlock(&nd.dentry->d_inode->i_mutex); > exit1: > path_release(&nd); > _