diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-26 07:01:01 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-05 09:01:31 -0500 |
commit | 67ee3ad21d0d0b2cc0b70708de8aed860fadda44 (patch) | |
tree | 842c575f8d7c06b4ebca8c418270da7207359767 | |
parent | 4296e2cbf2138b5831b83f03e81de916ce1a967d (diff) |
Pull handling of LAST_BIND into do_last(), clean up ok: part in do_filp_open()
Note that in case of !O_CREAT we know that nd.root has already been given up
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/fs/namei.c b/fs/namei.c index f5e4397dcd7e..0b4d19d47e67 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1656,6 +1656,9 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1656 | 1656 | ||
1657 | *is_link = 0; | 1657 | *is_link = 0; |
1658 | 1658 | ||
1659 | if (nd->last_type == LAST_BIND) | ||
1660 | goto ok; | ||
1661 | |||
1659 | error = -EISDIR; | 1662 | error = -EISDIR; |
1660 | if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) | 1663 | if (nd->last_type != LAST_NORM || nd->last.name[nd->last.len]) |
1661 | goto exit; | 1664 | goto exit; |
@@ -1733,6 +1736,7 @@ static struct file *do_last(struct nameidata *nd, struct path *path, | |||
1733 | error = -EISDIR; | 1736 | error = -EISDIR; |
1734 | if (S_ISDIR(path->dentry->d_inode->i_mode)) | 1737 | if (S_ISDIR(path->dentry->d_inode->i_mode)) |
1735 | goto exit; | 1738 | goto exit; |
1739 | ok: | ||
1736 | filp = finish_open(nd, open_flag, acc_mode); | 1740 | filp = finish_open(nd, open_flag, acc_mode); |
1737 | return filp; | 1741 | return filp; |
1738 | 1742 | ||
@@ -1808,7 +1812,7 @@ struct file *do_filp_open(int dfd, const char *pathname, | |||
1808 | release_open_intent(&nd); | 1812 | release_open_intent(&nd); |
1809 | if (error) | 1813 | if (error) |
1810 | return ERR_PTR(error); | 1814 | return ERR_PTR(error); |
1811 | goto ok; | 1815 | return finish_open(&nd, open_flag, acc_mode); |
1812 | } | 1816 | } |
1813 | 1817 | ||
1814 | /* | 1818 | /* |
@@ -1853,21 +1857,14 @@ reval: | |||
1853 | path_put(&nd.root); | 1857 | path_put(&nd.root); |
1854 | return filp; | 1858 | return filp; |
1855 | 1859 | ||
1856 | ok: | ||
1857 | filp = finish_open(&nd, open_flag, acc_mode); | ||
1858 | if (nd.root.mnt) | ||
1859 | path_put(&nd.root); | ||
1860 | return filp; | ||
1861 | |||
1862 | exit_dput: | 1860 | exit_dput: |
1863 | path_put_conditional(&path, &nd); | 1861 | path_put_conditional(&path, &nd); |
1864 | exit: | ||
1865 | if (!IS_ERR(nd.intent.open.file)) | 1862 | if (!IS_ERR(nd.intent.open.file)) |
1866 | release_open_intent(&nd); | 1863 | release_open_intent(&nd); |
1867 | exit_parent: | 1864 | exit_parent: |
1865 | path_put(&nd.path); | ||
1868 | if (nd.root.mnt) | 1866 | if (nd.root.mnt) |
1869 | path_put(&nd.root); | 1867 | path_put(&nd.root); |
1870 | path_put(&nd.path); | ||
1871 | return ERR_PTR(error); | 1868 | return ERR_PTR(error); |
1872 | 1869 | ||
1873 | do_link: | 1870 | do_link: |
@@ -1905,8 +1902,6 @@ do_link: | |||
1905 | return ERR_PTR(error); | 1902 | return ERR_PTR(error); |
1906 | } | 1903 | } |
1907 | nd.flags &= ~LOOKUP_PARENT; | 1904 | nd.flags &= ~LOOKUP_PARENT; |
1908 | if (nd.last_type == LAST_BIND) | ||
1909 | goto ok; | ||
1910 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, | 1905 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, |
1911 | pathname, &is_link); | 1906 | pathname, &is_link); |
1912 | if (nd.last_type == LAST_NORM) | 1907 | if (nd.last_type == LAST_NORM) |