From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jeff Layton Subject: Re: [PATCH 1/4] cifs: make cifs_lookup return a dentry Date: Fri, 21 May 2010 14:42:18 -0400 Message-ID: <20100521144218.4b83d6aa@corrin.poochiereds.net> References: <1274466317-28231-1-git-send-email-jlayton@redhat.com> <1274466317-28231-2-git-send-email-jlayton@redhat.com> <20100521184555.GR32248@dhcp231-156.rdu.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Cc: linux-cifs-client@lists.samba.org, linux-fsdevel@vger.kernel.org To: Josef Bacik Return-path: Received: from mx1.redhat.com ([209.132.183.28]:64920 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934253Ab0EUSlN (ORCPT ); Fri, 21 May 2010 14:41:13 -0400 In-Reply-To: <20100521184555.GR32248@dhcp231-156.rdu.redhat.com> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Fri, 21 May 2010 14:45:55 -0400 Josef Bacik wrote: > On Fri, May 21, 2010 at 02:25:14PM -0400, Jeff Layton wrote: > > cifs_lookup doesn't actually return a dentry. It instantiates the one > > that's passed in, but callers don't have any way to know if the lookup > > succeeded. > > > > Signed-off-by: Jeff Layton > > --- > > fs/cifs/dir.c | 13 +++++++++---- > > 1 files changed, 9 insertions(+), 4 deletions(-) > > > > diff --git a/fs/cifs/dir.c b/fs/cifs/dir.c > > index 391816b..54de8e5 100644 > > --- a/fs/cifs/dir.c > > +++ b/fs/cifs/dir.c > > @@ -639,6 +639,7 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, > > struct inode *newInode = NULL; > > char *full_path = NULL; > > struct file *filp; > > + struct dentry *res; > > > > xid = GetXid(); > > > > @@ -738,7 +739,8 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, > > /* since paths are not looked up by component - the parent > > directories are presumed to be good here */ > > renew_parental_timestamps(direntry); > > - > > + res = direntry; > > + dget(res); > > } else if (rc == -ENOENT) { > > rc = 0; > > direntry->d_time = jiffies; > > @@ -747,17 +749,20 @@ cifs_lookup(struct inode *parent_dir_inode, struct dentry *direntry, > > else > > direntry->d_op = &cifs_dentry_ops; > > d_add(direntry, NULL); > > - /* if it was once a directory (but how can we tell?) we could do > > - shrink_dcache_parent(direntry); */ > > + res = direntry; > > + dget(res); > > Should probably do > > res = dget(direntry) > Ahh good catch. Will fix. Thanks, -- Jeff Layton