Commit 70e9b357 authored by Al Viro's avatar Al Viro

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 951361f9
...@@ -1498,7 +1498,8 @@ static int link_path_walk(const char *name, struct nameidata *nd) ...@@ -1498,7 +1498,8 @@ static int link_path_walk(const char *name, struct nameidata *nd)
return err; 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 retval = 0;
int fput_needed; int fput_needed;
...@@ -1508,7 +1509,6 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei ...@@ -1508,7 +1509,6 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
nd->flags = flags | LOOKUP_JUMPED; nd->flags = flags | LOOKUP_JUMPED;
nd->depth = 0; nd->depth = 0;
nd->root.mnt = NULL; nd->root.mnt = NULL;
nd->file = NULL;
if (*name=='/') { if (*name=='/') {
if (flags & LOOKUP_RCU) { if (flags & LOOKUP_RCU) {
...@@ -1557,7 +1557,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei ...@@ -1557,7 +1557,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
nd->path = file->f_path; nd->path = file->f_path;
if (flags & LOOKUP_RCU) { if (flags & LOOKUP_RCU) {
if (fput_needed) if (fput_needed)
nd->file = file; *fp = file;
nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq);
br_read_lock(vfsmount_lock); br_read_lock(vfsmount_lock);
rcu_read_lock(); rcu_read_lock();
...@@ -1580,6 +1580,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei ...@@ -1580,6 +1580,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
static int path_lookupat(int dfd, const char *name, static int path_lookupat(int dfd, const char *name,
unsigned int flags, struct nameidata *nd) unsigned int flags, struct nameidata *nd)
{ {
struct file *base = NULL;
int retval; int retval;
/* /*
...@@ -1596,7 +1597,7 @@ static int path_lookupat(int dfd, const char *name, ...@@ -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 handled by restarting a traditional ref-walk (which will always
* be able to complete). * be able to complete).
*/ */
retval = path_init(dfd, name, flags, nd); retval = path_init(dfd, name, flags, nd, &base);
if (unlikely(retval)) if (unlikely(retval))
return retval; return retval;
...@@ -1614,10 +1615,8 @@ static int path_lookupat(int dfd, const char *name, ...@@ -1614,10 +1615,8 @@ static int path_lookupat(int dfd, const char *name,
if (!retval) if (!retval)
retval = handle_reval_path(nd); retval = handle_reval_path(nd);
if (nd->file) { if (base)
fput(nd->file); fput(base);
nd->file = NULL;
}
if (nd->root.mnt) { if (nd->root.mnt) {
path_put(&nd->root); path_put(&nd->root);
......
...@@ -19,7 +19,6 @@ struct nameidata { ...@@ -19,7 +19,6 @@ struct nameidata {
struct path path; struct path path;
struct qstr last; struct qstr last;
struct path root; struct path root;
struct file *file;
struct inode *inode; /* path.dentry.d_inode */ struct inode *inode; /* path.dentry.d_inode */
unsigned int flags; unsigned int flags;
unsigned seq; unsigned seq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment