aboutsummaryrefslogtreecommitdiffstats
path: root/fs/namei.c
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 /fs/namei.c
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>
Diffstat (limited to 'fs/namei.c')
-rw-r--r--fs/namei.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 85f6e39b4034..a260a306daf5 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1498,7 +1498,8 @@ lookup_parent:
1498 return err; 1498 return err;
1499} 1499}
1500 1500
1501static int path_init(int dfd, const char *name, unsigned int flags, struct nameidata *nd) 1501static int path_init(int dfd, const char *name, unsigned int flags,
1502 struct nameidata *nd, struct file **fp)
1502{ 1503{
1503 int retval = 0; 1504 int retval = 0;
1504 int fput_needed; 1505 int fput_needed;
@@ -1508,7 +1509,6 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
1508 nd->flags = flags | LOOKUP_JUMPED; 1509 nd->flags = flags | LOOKUP_JUMPED;
1509 nd->depth = 0; 1510 nd->depth = 0;
1510 nd->root.mnt = NULL; 1511 nd->root.mnt = NULL;
1511 nd->file = NULL;
1512 1512
1513 if (*name=='/') { 1513 if (*name=='/') {
1514 if (flags & LOOKUP_RCU) { 1514 if (flags & LOOKUP_RCU) {
@@ -1557,7 +1557,7 @@ static int path_init(int dfd, const char *name, unsigned int flags, struct namei
1557 nd->path = file->f_path; 1557 nd->path = file->f_path;
1558 if (flags & LOOKUP_RCU) { 1558 if (flags & LOOKUP_RCU) {
1559 if (fput_needed) 1559 if (fput_needed)
1560 nd->file = file; 1560 *fp = file;
1561 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq); 1561 nd->seq = __read_seqcount_begin(&nd->path.dentry->d_seq);
1562 br_read_lock(vfsmount_lock); 1562 br_read_lock(vfsmount_lock);
1563 rcu_read_lock(); 1563 rcu_read_lock();
@@ -1580,6 +1580,7 @@ out_fail:
1580static int path_lookupat(int dfd, const char *name, 1580static int path_lookupat(int dfd, const char *name,
1581 unsigned int flags, struct nameidata *nd) 1581 unsigned int flags, struct nameidata *nd)
1582{ 1582{
1583 struct file *base = NULL;
1583 int retval; 1584 int retval;
1584 1585
1585 /* 1586 /*
@@ -1596,7 +1597,7 @@ static int path_lookupat(int dfd, const char *name,
1596 * be handled by restarting a traditional ref-walk (which will always 1597 * be handled by restarting a traditional ref-walk (which will always
1597 * be able to complete). 1598 * be able to complete).
1598 */ 1599 */
1599 retval = path_init(dfd, name, flags, nd); 1600 retval = path_init(dfd, name, flags, nd, &base);
1600 1601
1601 if (unlikely(retval)) 1602 if (unlikely(retval))
1602 return retval; 1603 return retval;
@@ -1614,10 +1615,8 @@ static int path_lookupat(int dfd, const char *name,
1614 if (!retval) 1615 if (!retval)
1615 retval = handle_reval_path(nd); 1616 retval = handle_reval_path(nd);
1616 1617
1617 if (nd->file) { 1618 if (base)
1618 fput(nd->file); 1619 fput(base);
1619 nd->file = NULL;
1620 }
1621 1620
1622 if (nd->root.mnt) { 1621 if (nd->root.mnt) {
1623 path_put(&nd->root); 1622 path_put(&nd->root);