From: Herbert Poetzl Subject: Re: [RFC][PATCH 18/27] sys_faccessat(): collapse if() Date: Thu, 8 Jun 2006 13:05:17 +0200 Message-ID: <20060608110517.GJ11996@MAIL.13thfloor.at> References: <20060608001013.0D041507@localhost.localdomain> <20060608001029.2F5F11B3@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]:29584 "EHLO mail.13thfloor.at") by vger.kernel.org with ESMTP id S964813AbWFHLFS (ORCPT ); Thu, 8 Jun 2006 07:05:18 -0400 To: Dave Hansen Content-Disposition: inline In-Reply-To: <20060608001029.2F5F11B3@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Wed, Jun 07, 2006 at 05:10:29PM -0700, Dave Hansen wrote: > > This patch should make no functional changes. wrong order, but IMHO this one should do the goto out_path_release change of the previous one best, Herbert > Signed-off-by: Dave Hansen > --- > > lxc-dave/fs/open.c | 18 ++++++++++-------- > 1 files changed, 10 insertions(+), 8 deletions(-) > > diff -puN fs/open.c~elevate-writers-opens-part2-sys_faccessat fs/open.c > --- lxc/fs/open.c~elevate-writers-opens-part2-sys_faccessat 2006-06-07 16:53:23.000000000 -0700 > +++ lxc-dave/fs/open.c 2006-06-07 16:53:23.000000000 -0700 > @@ -537,15 +537,17 @@ asmlinkage long sys_faccessat(int dfd, c > current->cap_effective = current->cap_permitted; > > res = __user_walk_fd(dfd, filename, LOOKUP_FOLLOW|LOOKUP_ACCESS, &nd); > - if (!res) { > - res = vfs_permission(&nd, mode); > - /* SuS v2 requires we report a read only fs too */ > - if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) > - && !special_file(nd.dentry->d_inode->i_mode)) > - res = -EROFS; > - path_release(&nd); > - } > + if (res) > + goto out; > > + res = vfs_permission(&nd, mode); > + /* SuS v2 requires we report a read only fs too */ > + if(!res && (mode & S_IWOTH) && IS_RDONLY(nd.dentry->d_inode) > + && !special_file(nd.dentry->d_inode->i_mode)) > + res = -EROFS; > + path_release(&nd); > + > +out: > current->fsuid = old_fsuid; > current->fsgid = old_fsgid; > current->cap_effective = old_cap; > _