From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964948AbbCPUrh (ORCPT ); Mon, 16 Mar 2015 16:47:37 -0400 Received: from zeniv.linux.org.uk ([195.92.253.2]:34272 "EHLO ZenIV.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933524AbbCPUre (ORCPT ); Mon, 16 Mar 2015 16:47:34 -0400 Date: Mon, 16 Mar 2015 20:47:32 +0000 From: Al Viro To: NeilBrown Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 03/13] VFS: remove nameidata args from ->follow_link and ->put_link 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 Content-Disposition: inline In-Reply-To: <20150316044319.23648.2840.stgit@notabene.brown> 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, 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...