aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2010-03-26 12:40:13 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2010-03-26 12:41:05 -0400
commit3e297b613491f0d4928aa652a2cd266aa06dc409 (patch)
treedf688c6226e84768a0748d4a19cb893255f0bebf
parent01e77706cdde7c0b47e5ca1f4284a795504c7c40 (diff)
Restore LOOKUP_DIRECTORY hint handling in final lookup on open()
Lose want_dir argument, while we are at it - since now nd->flags & LOOKUP_DIRECTORY is equivalent to it. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--fs/namei.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 1c0fca6e899e..a7dce91a7e42 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -1610,8 +1610,7 @@ exit:
1610 1610
1611static struct file *do_last(struct nameidata *nd, struct path *path, 1611static struct file *do_last(struct nameidata *nd, struct path *path,
1612 int open_flag, int acc_mode, 1612 int open_flag, int acc_mode,
1613 int mode, const char *pathname, 1613 int mode, const char *pathname)
1614 int *want_dir)
1615{ 1614{
1616 struct dentry *dir = nd->path.dentry; 1615 struct dentry *dir = nd->path.dentry;
1617 struct file *filp; 1616 struct file *filp;
@@ -1642,7 +1641,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
1642 if (nd->last.name[nd->last.len]) { 1641 if (nd->last.name[nd->last.len]) {
1643 if (open_flag & O_CREAT) 1642 if (open_flag & O_CREAT)
1644 goto exit; 1643 goto exit;
1645 *want_dir = 1; 1644 nd->flags |= LOOKUP_DIRECTORY;
1646 } 1645 }
1647 1646
1648 /* just plain open? */ 1647 /* just plain open? */
@@ -1656,8 +1655,10 @@ static struct file *do_last(struct nameidata *nd, struct path *path,
1656 if (path->dentry->d_inode->i_op->follow_link) 1655 if (path->dentry->d_inode->i_op->follow_link)
1657 return NULL; 1656 return NULL;
1658 error = -ENOTDIR; 1657 error = -ENOTDIR;
1659 if (*want_dir && !path->dentry->d_inode->i_op->lookup) 1658 if (nd->flags & LOOKUP_DIRECTORY) {
1660 goto exit_dput; 1659 if (!path->dentry->d_inode->i_op->lookup)
1660 goto exit_dput;
1661 }
1661 path_to_nameidata(path, nd); 1662 path_to_nameidata(path, nd);
1662 audit_inode(pathname, nd->path.dentry); 1663 audit_inode(pathname, nd->path.dentry);
1663 goto ok; 1664 goto ok;
@@ -1766,7 +1767,6 @@ struct file *do_filp_open(int dfd, const char *pathname,
1766 int count = 0; 1767 int count = 0;
1767 int flag = open_to_namei_flags(open_flag); 1768 int flag = open_to_namei_flags(open_flag);
1768 int force_reval = 0; 1769 int force_reval = 0;
1769 int want_dir = open_flag & O_DIRECTORY;
1770 1770
1771 if (!(open_flag & O_CREAT)) 1771 if (!(open_flag & O_CREAT))
1772 mode = 0; 1772 mode = 0;
@@ -1828,7 +1828,9 @@ reval:
1828 if (open_flag & O_EXCL) 1828 if (open_flag & O_EXCL)
1829 nd.flags |= LOOKUP_EXCL; 1829 nd.flags |= LOOKUP_EXCL;
1830 } 1830 }
1831 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname, &want_dir); 1831 if (open_flag & O_DIRECTORY)
1832 nd.flags |= LOOKUP_DIRECTORY;
1833 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
1832 while (unlikely(!filp)) { /* trailing symlink */ 1834 while (unlikely(!filp)) { /* trailing symlink */
1833 struct path holder; 1835 struct path holder;
1834 struct inode *inode = path.dentry->d_inode; 1836 struct inode *inode = path.dentry->d_inode;
@@ -1866,7 +1868,7 @@ reval:
1866 } 1868 }
1867 holder = path; 1869 holder = path;
1868 nd.flags &= ~LOOKUP_PARENT; 1870 nd.flags &= ~LOOKUP_PARENT;
1869 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname, &want_dir); 1871 filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname);
1870 if (inode->i_op->put_link) 1872 if (inode->i_op->put_link)
1871 inode->i_op->put_link(holder.dentry, &nd, cookie); 1873 inode->i_op->put_link(holder.dentry, &nd, cookie);
1872 path_put(&holder); 1874 path_put(&holder);