From mboxrd@z Thu Jan 1 00:00:00 1970 From: Al Viro Subject: Re: [PATCH 03/13] VFS: remove nameidata args from ->follow_link and ->put_link Date: Mon, 16 Mar 2015 20:47:32 +0000 Message-ID: <20150316204732.GB29656@ZenIV.linux.org.uk> References: <20150316043602.23648.52734.stgit@notabene.brown> <20150316044319.23648.2840.stgit@notabene.brown> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org To: NeilBrown Return-path: Content-Disposition: inline In-Reply-To: <20150316044319.23648.2840.stgit@notabene.brown> Sender: linux-kernel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Mon, Mar 16, 2015 at 03:43:19PM +1100, NeilBrown wrote: > Now that current->nameidata is available, nd_set_link() and > nd_get_link() can use that directly, so 'nd' doesn't need to > be passed through ->follow_link and ->put_link. FWIW, I would rather pass nd_get_link(nd) to ->put_link() instead of nd. Note that that's the only thing instances were ever using nd for; what's more, that's the only thing nd_get_link() is ever used for outside of fs/namei.c, so with that change it could become static in fs/namei.c. After such change we would have it used in * follow_link(). We have nd right there. * put_link(). Ditto. * generic_readlink(). Again, nd is right there (and we obviously only need to call nd_get_link() once). Hell, it can even become static inline... > nd->last_type = LAST_BIND; > - *p = dentry->d_inode->i_op->follow_link(dentry, nd); > + *p = dentry->d_inode->i_op->follow_link(dentry, nd->flags); I'm not sure if it's a good idea to expose all flags here - it's really asking for somebody trying to be "smart" and acting differently depending on what we are doing pathname resolution for/where in lookup we are/etc. nd->flags & LOOKUP_RCU might be less tempting. > @@ -4458,13 +4464,13 @@ int generic_readlink(struct dentry *dentry, char __user *buffer, int buflen) > int res; > > nd.depth = 0; > - cookie = dentry->d_inode->i_op->follow_link(dentry, &nd); > + cookie = dentry->d_inode->i_op->follow_link(dentry, nd.flags); ...(dentry, 0); nd.flags is uninitialized, for pity sake...