diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2009-12-26 07:09:49 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2010-03-05 09:01:35 -0500 |
commit | 10fa8e62f2bc33c452516585911f151d88389e4c (patch) | |
tree | 9a69dd68ffdf419cd6391f198ff40ac0943b9a35 /fs/namei.c | |
parent | 9e67f36169117e07daf16dc7ca314f1db9e2050a (diff) |
Unify exits in O_CREAT handling
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 30 |
1 files changed, 13 insertions, 17 deletions
diff --git a/fs/namei.c b/fs/namei.c index b0c74fe91fb0..675a712137f1 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1821,9 +1821,8 @@ reval: | |||
1821 | nd.flags |= LOOKUP_REVAL; | 1821 | nd.flags |= LOOKUP_REVAL; |
1822 | error = path_walk(pathname, &nd); | 1822 | error = path_walk(pathname, &nd); |
1823 | if (error) { | 1823 | if (error) { |
1824 | if (nd.root.mnt) | 1824 | filp = ERR_PTR(error); |
1825 | path_put(&nd.root); | 1825 | goto out; |
1826 | return ERR_PTR(error); | ||
1827 | } | 1826 | } |
1828 | if (unlikely(!audit_dummy_context())) | 1827 | if (unlikely(!audit_dummy_context())) |
1829 | audit_inode(pathname, nd.path.dentry); | 1828 | audit_inode(pathname, nd.path.dentry); |
@@ -1847,9 +1846,7 @@ reval: | |||
1847 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 1846 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
1848 | if (!filp) | 1847 | if (!filp) |
1849 | goto do_link; | 1848 | goto do_link; |
1850 | if (nd.root.mnt) | 1849 | goto out; |
1851 | path_put(&nd.root); | ||
1852 | return filp; | ||
1853 | 1850 | ||
1854 | exit_dput: | 1851 | exit_dput: |
1855 | path_put_conditional(&path, &nd); | 1852 | path_put_conditional(&path, &nd); |
@@ -1857,9 +1854,15 @@ exit_dput: | |||
1857 | release_open_intent(&nd); | 1854 | release_open_intent(&nd); |
1858 | exit_parent: | 1855 | exit_parent: |
1859 | path_put(&nd.path); | 1856 | path_put(&nd.path); |
1857 | filp = ERR_PTR(error); | ||
1858 | out: | ||
1860 | if (nd.root.mnt) | 1859 | if (nd.root.mnt) |
1861 | path_put(&nd.root); | 1860 | path_put(&nd.root); |
1862 | return ERR_PTR(error); | 1861 | if (filp == ERR_PTR(-ESTALE) && !force_reval) { |
1862 | force_reval = 1; | ||
1863 | goto reval; | ||
1864 | } | ||
1865 | return filp; | ||
1863 | 1866 | ||
1864 | do_link: | 1867 | do_link: |
1865 | error = -ELOOP; | 1868 | error = -ELOOP; |
@@ -1887,13 +1890,8 @@ do_link: | |||
1887 | * with "intent.open". | 1890 | * with "intent.open". |
1888 | */ | 1891 | */ |
1889 | release_open_intent(&nd); | 1892 | release_open_intent(&nd); |
1890 | if (nd.root.mnt) | 1893 | filp = ERR_PTR(error); |
1891 | path_put(&nd.root); | 1894 | goto out; |
1892 | if (error == -ESTALE && !force_reval) { | ||
1893 | force_reval = 1; | ||
1894 | goto reval; | ||
1895 | } | ||
1896 | return ERR_PTR(error); | ||
1897 | } | 1895 | } |
1898 | nd.flags &= ~LOOKUP_PARENT; | 1896 | nd.flags &= ~LOOKUP_PARENT; |
1899 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); | 1897 | filp = do_last(&nd, &path, open_flag, acc_mode, mode, pathname); |
@@ -1901,9 +1899,7 @@ do_link: | |||
1901 | __putname(nd.last.name); | 1899 | __putname(nd.last.name); |
1902 | if (!filp) | 1900 | if (!filp) |
1903 | goto do_link; | 1901 | goto do_link; |
1904 | if (nd.root.mnt) | 1902 | goto out; |
1905 | path_put(&nd.root); | ||
1906 | return filp; | ||
1907 | } | 1903 | } |
1908 | 1904 | ||
1909 | /** | 1905 | /** |