Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753661AbaBCWkm (ORCPT ); Mon, 3 Feb 2014 17:40:42 -0500 Received: from zeniv.linux.org.uk ([195.92.253.2]:42775 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753443AbaBCWkk (ORCPT ); Mon, 3 Feb 2014 17:40:40 -0500 Date: Mon, 3 Feb 2014 22:40:35 +0000 From: Al Viro To: Linus Torvalds Cc: Christoph Hellwig , Ilya Dryomov , Sage Weil , Dave Jones , Linux Kernel Mailing List , ceph-devel@vger.kernel.org, linux-fsdevel , Guangliang Zhao , Li Wang , zheng.z.yan@intel.com Subject: Re: [PATCH v2] ceph: fix posix ACL hooks Message-ID: <20140203224034.GF10323@ZenIV.linux.org.uk> References: <1391013467-7598-1-git-send-email-ilya.dryomov@inktank.com> <20140130075421.GA10050@infradead.org> <20140203102943.GF11829@infradead.org> <20140203215908.GD10323@ZenIV.linux.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 03, 2014 at 02:12:00PM -0800, Linus Torvalds wrote: > >> -int afs_permission(struct inode *inode, int mask) > >> +int afs_permission(struct dentry *dentry, struct inode *inode, int mask) > > > > Oh, _lovely_. So not only do we pass dentry, the arguments are redundant > > as well. > > Note that *not* passing in inode would make the patch much bigger, > because now every filesystem would have to add the > > struct inode *inode = dentry->d_inode; > > at the top. > > Also, I'm not actually convinced it is redundant at all. Remember the > RCU lookup case? dentry->d_inode is not safe. Umm... Point, but that actually means that we get an extra pitfall for filesystem writers here. foo_permission() passes dentry (now that it has one) to foo_wank_a_lot(), with the latter using dentry->d_inode at some point... > >> +static int gfs2_vfs_permission(struct dentry *dentry, struct inode *inode, int mask) > >> +{ > >> + return gfs2_permission(inode, mask); > >> +} > > > > Er... You do realize that callers of gfs2_permission() tend to have > > the dentry in question, either directly or as ->d_parent of something > > they have? > > Not true. Look closer. > > Look at gfs2_lookupi() in particular, and check how it is called. Yeowch... gfs2_ok_to_move() is particulary nasty... WTF do we need it for and why is it not racy as hell? -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/