From: Jeff Layton Subject: Re: [PATCH 1/4] cifs: make cifs_lookup return a dentry Date: Sat, 22 May 2010 11:23:46 -0400 Message-ID: <20100522112346.279368b8@tlielax.poochiereds.net> References: <1274466317-28231-1-git-send-email-jlayton@redhat.com> <1274466317-28231-2-git-send-email-jlayton@redhat.com> <20100522133051.GL31073@ZenIV.linux.org.uk> <20100522100836.28b95cff@tlielax.poochiereds.net> <20100522144615.GN31073@ZenIV.linux.org.uk> 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: Al Viro Return-path: Received: from mx1.redhat.com ([209.132.183.28]:12970 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754742Ab0EVPXs (ORCPT ); Sat, 22 May 2010 11:23:48 -0400 In-Reply-To: <20100522144615.GN31073@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Sat, 22 May 2010 15:46:15 +0100 Al Viro wrote: > On Sat, May 22, 2010 at 10:08:36AM -0400, Jeff Layton wrote: > > On Sat, 22 May 2010 14:30:51 +0100 > > Al Viro 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. > > > > > > Huh? Of course they do - ->lookup() has every right to do just that; > > > d_add() and return NULL is perfectly legitimate. > > > > OK, bad description on my part... Is one way of doing this preferred > > over another? > > Non-NULL, non ERR_PTR() strongly implies that you have found a different > dentry and tell the caller to use it instead; returning the argument (after > having cached it and bumped its refcount) will work, but it's pretty much > a deliberate obfuscation. Ok, thanks for the explanation. In that case, I'll plan to drop this patch as the existing behavior is more clear. Cheers, -- Jeff Layton