diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-30 02:03:31 -0500 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-12-31 18:07:44 -0500 |
commit | 6b38e842bb832a3dbeb17e382404aef3c40ac5f9 (patch) | |
tree | c36830341781bf49ded16a0d5432647979a74ad8 /fs/ext4/namei.c | |
parent | c38012daa7ad902a39a4213ba2b3fe50e81157ea (diff) |
nfsd race fixes: ext4
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext4/namei.c')
-rw-r--r-- | fs/ext4/namei.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 63adcb792988..da98a9012fa5 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -1693,9 +1693,11 @@ static int ext4_add_nondir(handle_t *handle, | |||
1693 | if (!err) { | 1693 | if (!err) { |
1694 | ext4_mark_inode_dirty(handle, inode); | 1694 | ext4_mark_inode_dirty(handle, inode); |
1695 | d_instantiate(dentry, inode); | 1695 | d_instantiate(dentry, inode); |
1696 | unlock_new_inode(inode); | ||
1696 | return 0; | 1697 | return 0; |
1697 | } | 1698 | } |
1698 | drop_nlink(inode); | 1699 | drop_nlink(inode); |
1700 | unlock_new_inode(inode); | ||
1699 | iput(inode); | 1701 | iput(inode); |
1700 | return err; | 1702 | return err; |
1701 | } | 1703 | } |
@@ -1830,6 +1832,7 @@ retry: | |||
1830 | if (err) { | 1832 | if (err) { |
1831 | out_clear_inode: | 1833 | out_clear_inode: |
1832 | clear_nlink(inode); | 1834 | clear_nlink(inode); |
1835 | unlock_new_inode(inode); | ||
1833 | ext4_mark_inode_dirty(handle, inode); | 1836 | ext4_mark_inode_dirty(handle, inode); |
1834 | iput(inode); | 1837 | iput(inode); |
1835 | goto out_stop; | 1838 | goto out_stop; |
@@ -1838,6 +1841,7 @@ out_clear_inode: | |||
1838 | ext4_update_dx_flag(dir); | 1841 | ext4_update_dx_flag(dir); |
1839 | ext4_mark_inode_dirty(handle, dir); | 1842 | ext4_mark_inode_dirty(handle, dir); |
1840 | d_instantiate(dentry, inode); | 1843 | d_instantiate(dentry, inode); |
1844 | unlock_new_inode(inode); | ||
1841 | out_stop: | 1845 | out_stop: |
1842 | ext4_journal_stop(handle); | 1846 | ext4_journal_stop(handle); |
1843 | if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) | 1847 | if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) |
@@ -2212,6 +2216,7 @@ retry: | |||
2212 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | 2216 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); |
2213 | if (err) { | 2217 | if (err) { |
2214 | clear_nlink(inode); | 2218 | clear_nlink(inode); |
2219 | unlock_new_inode(inode); | ||
2215 | ext4_mark_inode_dirty(handle, inode); | 2220 | ext4_mark_inode_dirty(handle, inode); |
2216 | iput(inode); | 2221 | iput(inode); |
2217 | goto out_stop; | 2222 | goto out_stop; |
@@ -2262,7 +2267,14 @@ retry: | |||
2262 | ext4_inc_count(handle, inode); | 2267 | ext4_inc_count(handle, inode); |
2263 | atomic_inc(&inode->i_count); | 2268 | atomic_inc(&inode->i_count); |
2264 | 2269 | ||
2265 | err = ext4_add_nondir(handle, dentry, inode); | 2270 | err = ext4_add_entry(handle, dentry, inode); |
2271 | if (!err) { | ||
2272 | ext4_mark_inode_dirty(handle, inode); | ||
2273 | d_instantiate(dentry, inode); | ||
2274 | } else { | ||
2275 | drop_nlink(inode); | ||
2276 | iput(inode); | ||
2277 | } | ||
2266 | ext4_journal_stop(handle); | 2278 | ext4_journal_stop(handle); |
2267 | if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) | 2279 | if (err == -ENOSPC && ext4_should_retry_alloc(dir->i_sb, &retries)) |
2268 | goto retry; | 2280 | goto retry; |