From patchwork Fri May 21 18:25:14 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 101536 Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4LIPQ3b021028 for ; Fri, 21 May 2010 18:26:02 GMT Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id 9443E46615; Fri, 21 May 2010 12:25:27 -0600 (MDT) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-3.7 required=3.8 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from cdptpa-omtalb.mail.rr.com (cdptpa-omtalb.mail.rr.com [75.180.132.123]) by lists.samba.org (Postfix) with ESMTP id EDAEBAD098 for ; Fri, 21 May 2010 12:25:19 -0600 (MDT) X-Authority-Analysis: v=1.1 cv=+ekMi77mZ5GklOGOY/oEe0KM76mYTylHWjxFepbNIe4= c=1 sm=0 a=2GsdFx-k8S8A:10 a=GQCbJdZ--msA:10 a=ld/erqUjW76FpBUqCqkKeA==:17 a=20KFwNOVAAAA:8 a=3zxyTB_q_LEgps01SLwA:9 a=649BJec4REWYcvZgENi1UtrwgCkA:4 a=jEp0ucaQiEUA:10 a=ld/erqUjW76FpBUqCqkKeA==:117 X-Cloudmark-Score: 0 X-Originating-IP: 71.70.153.3 Received: from [71.70.153.3] ([71.70.153.3:38603] helo=mail.poochiereds.net) by cdptpa-oedge02.mail.rr.com (envelope-from ) (ecelerity 2.2.2.39 r()) with ESMTP id 68/4E-19173-E00D6FB4; Fri, 21 May 2010 18:25:18 +0000 Received: by mail.poochiereds.net (Postfix, from userid 4447) id CA6D0580AF; Fri, 21 May 2010 14:25:17 -0400 (EDT) From: Jeff Layton To: linux-cifs-client@lists.samba.org Date: Fri, 21 May 2010 14:25:14 -0400 Message-Id: <1274466317-28231-2-git-send-email-jlayton@redhat.com> X-Mailer: git-send-email 1.6.6.1 In-Reply-To: <1274466317-28231-1-git-send-email-jlayton@redhat.com> References: <1274466317-28231-1-git-send-email-jlayton@redhat.com> Cc: linux-fsdevel@vger.kernel.org Subject: [linux-cifs-client] [PATCH 1/4] cifs: make cifs_lookup return a dentry X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Fri, 21 May 2010 18:26:02 +0000 (UTC) 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); } else if (rc != -EACCES) { cERROR(1, "Unexpected lookup error %d", rc); /* We special case check for Access Denied - since that is a common return code */ + res = ERR_PTR(rc); + } else { + res = ERR_PTR(rc); } kfree(full_path); FreeXid(xid); - return ERR_PTR(rc); + return res; } static int