From: Jeff Layton <jlayton@redhat.com>
To: linux-cifs-client@lists.samba.org
Cc: linux-fsdevel@vger.kernel.org
Subject: [PATCH 1/4] cifs: make cifs_lookup return a dentry
Date: Fri, 21 May 2010 14:25:14 -0400 [thread overview]
Message-ID: <1274466317-28231-2-git-send-email-jlayton@redhat.com> (raw)
In-Reply-To: <1274466317-28231-1-git-send-email-jlayton@redhat.com>
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 <jlayton@redhat.com>
---
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);
} 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
--
1.6.6.1
next prev parent reply other threads:[~2010-05-21 18:25 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-05-21 18:25 [PATCH 0/4] cifs: fix "Busy inodes after umount" issues (RFC) Jeff Layton
2010-05-21 18:25 ` Jeff Layton [this message]
2010-05-21 18:45 ` [PATCH 1/4] cifs: make cifs_lookup return a dentry Josef Bacik
2010-05-21 18:42 ` Jeff Layton
2010-05-22 13:30 ` Al Viro
2010-05-22 14:08 ` Jeff Layton
2010-05-22 14:46 ` Al Viro
2010-05-22 15:23 ` Jeff Layton
2010-05-21 18:25 ` [PATCH 2/4] cifs: don't leave open files dangling Jeff Layton
2010-05-24 6:50 ` [linux-cifs-client] " Suresh Jayaraman
2010-05-24 10:49 ` Jeff Layton
2010-05-21 18:25 ` [PATCH 3/4] cifs: move cifs_new_fileinfo call out of cifs_posix_open Jeff Layton
2010-05-24 6:50 ` [linux-cifs-client] " Suresh Jayaraman
2010-05-24 10:48 ` Jeff Layton
2010-05-21 18:25 ` [PATCH 4/4] cifs: pass instantiated filp back after open call Jeff Layton
2010-05-24 7:13 ` [PATCH 0/4] cifs: fix "Busy inodes after umount" issues (RFC) Suresh Jayaraman
2010-05-24 10:52 ` [linux-cifs-client] " Jeff Layton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1274466317-28231-2-git-send-email-jlayton@redhat.com \
--to=jlayton@redhat.com \
--cc=linux-cifs-client@lists.samba.org \
--cc=linux-fsdevel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).