aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-03-05 21:12:22 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2011-03-14 09:15:26 -0400
commit70e9b3571107b88674cd55ae4bed33f76261e7d3 (patch)
treea22a2cd29b3075ddb9fed4305fd0ff88c07d5963
parent951361f954596bd134d4270df834f47d151f98a6 (diff)
get rid of nd->file
Don't stash the struct file * used as starting point of walk in nameidata; pass file ** to path_init() instead. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c15
-rw-r--r--include/linux/namei.h1
2 files changed, 7 insertions, 9 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 85f6e39b403..a260a306daf 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1498,7 +1498,8 @@ lookup_parent:
return err;
}
-static int path_init(int dfd, const char *name, unsigned int flags, struct nameidata *nd)
+static int path_init(int dfd, const char *name, unsigned int flags,
+ struct nameidata *nd, struct file **fp)
{
int retval = 0;
int fput_needed;
@@ -1508,7 +1509,6 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
nd->flags = flags | LOOKUP_JUMPED;
nd->depth = 0;
nd->root.mnt = NULL;
- nd->file = NULL;
if (*name=='/') {
if (flags & LOOKUP_RCU) {
@@ -1557,7 +1557,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
nd->path = file->f_path;
if (flags & LOOKUP_RCU) {
if (fput_needed)
- nd->file = file;
+ *fp = file;
nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq);
br_read_lock(vfsmount_lock);
rcu_read_lock();
@@ -1580,6 +1580,7 @@ out_fail:
static int path_lookupat(int dfd, const char *name,
unsigned int flags, struct nameidata *nd)
{
+ struct file *base = NULL;
int retval;
/*
@@ -1596,7 +1597,7 @@ static int path_lookupat(int dfd, const char *name,
* be handled by restarting a traditional ref-walk (which will always
* be able to complete).
*/
- retval = path_init(dfd, name, flags, nd);
+ retval = path_init(dfd, name, flags, nd, &base);
if (unlikely(retval))
return retval;
@@ -1614,10 +1615,8 @@ static int path_lookupat(int dfd, const char *name,
if (!retval)
retval = handle_reval_path(nd);
- if (nd->file) {
- fput(nd->file);
- nd->file = NULL;
- }
+ if (base)
+ fput(base);
if (nd->root.mnt) {
path_put(&nd->root);
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 265378a707b..72ffd62ac73 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -19,7 +19,6 @@ struct nameidata {
struct path path;
struct qstr last;
struct path root;
- struct file *file;
struct inode *inode; /* path.dentry.d_inode */
unsigned int flags;
unsigned seq;