From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dave Hansen Subject: [RFC][PATCH 02/27] vfs_rmdir: change if() into goto Date: Wed, 07 Jun 2006 17:10:15 -0700 Message-ID: <20060608001015.CBE0A7A8@localhost.localdomain> References: <20060608001013.0D041507@localhost.localdomain> Cc: herbert@13thfloor.at, viro@ftp.linux.org.uk, hch@infradead.org, trond.myklebust@fys.uio.no, Dave Hansen Return-path: Received: from e34.co.us.ibm.com ([32.97.110.152]:57060 "EHLO e34.co.us.ibm.com") by vger.kernel.org with ESMTP id S932477AbWFHAK2 (ORCPT ); Wed, 7 Jun 2006 20:10:28 -0400 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e34.co.us.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id k580AJmu010933 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 7 Jun 2006 20:10:19 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.13.6/NCO/VER7.0) with ESMTP id k580AJPX210910 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Wed, 7 Jun 2006 18:10:19 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id k580AIHt008082 for ; Wed, 7 Jun 2006 18:10:19 -0600 To: linux-fsdevel@vger.kernel.org In-Reply-To: <20060608001013.0D041507@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org 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. 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); _