aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext3/namei.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2008-12-30 02:02:50 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2008-12-31 18:07:44 -0500
commitc38012daa7ad902a39a4213ba2b3fe50e81157ea (patch)
tree69dd3bdf2efe82f9bee13eaf729df7bf70e89381 /fs/ext3/namei.c
parent41080b5a240113328c607f22b849f653373db0ce (diff)
nfsd race fixes: ext3
ext3 analog of the previous patch Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/ext3/namei.c')
-rw-r--r--fs/ext3/namei.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c
index 3e5edc92aa0b..297ea8dfac7c 100644
--- a/fs/ext3/namei.c
+++ b/fs/ext3/namei.c
@@ -1652,9 +1652,11 @@ static int ext3_add_nondir(handle_t *handle,
1652 if (!err) { 1652 if (!err) {
1653 ext3_mark_inode_dirty(handle, inode); 1653 ext3_mark_inode_dirty(handle, inode);
1654 d_instantiate(dentry, inode); 1654 d_instantiate(dentry, inode);
1655 unlock_new_inode(inode);
1655 return 0; 1656 return 0;
1656 } 1657 }
1657 drop_nlink(inode); 1658 drop_nlink(inode);
1659 unlock_new_inode(inode);
1658 iput(inode); 1660 iput(inode);
1659 return err; 1661 return err;
1660} 1662}
@@ -1765,6 +1767,7 @@ retry:
1765 dir_block = ext3_bread (handle, inode, 0, 1, &err); 1767 dir_block = ext3_bread (handle, inode, 0, 1, &err);
1766 if (!dir_block) { 1768 if (!dir_block) {
1767 drop_nlink(inode); /* is this nlink == 0? */ 1769 drop_nlink(inode); /* is this nlink == 0? */
1770 unlock_new_inode(inode);
1768 ext3_mark_inode_dirty(handle, inode); 1771 ext3_mark_inode_dirty(handle, inode);
1769 iput (inode); 1772 iput (inode);
1770 goto out_stop; 1773 goto out_stop;
@@ -1792,6 +1795,7 @@ retry:
1792 err = ext3_add_entry (handle, dentry, inode); 1795 err = ext3_add_entry (handle, dentry, inode);
1793 if (err) { 1796 if (err) {
1794 inode->i_nlink = 0; 1797 inode->i_nlink = 0;
1798 unlock_new_inode(inode);
1795 ext3_mark_inode_dirty(handle, inode); 1799 ext3_mark_inode_dirty(handle, inode);
1796 iput (inode); 1800 iput (inode);
1797 goto out_stop; 1801 goto out_stop;
@@ -1800,6 +1804,7 @@ retry:
1800 ext3_update_dx_flag(dir); 1804 ext3_update_dx_flag(dir);
1801 ext3_mark_inode_dirty(handle, dir); 1805 ext3_mark_inode_dirty(handle, dir);
1802 d_instantiate(dentry, inode); 1806 d_instantiate(dentry, inode);
1807 unlock_new_inode(inode);
1803out_stop: 1808out_stop:
1804 ext3_journal_stop(handle); 1809 ext3_journal_stop(handle);
1805 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) 1810 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
@@ -2174,6 +2179,7 @@ retry:
2174 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); 2179 mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS);
2175 if (err) { 2180 if (err) {
2176 drop_nlink(inode); 2181 drop_nlink(inode);
2182 unlock_new_inode(inode);
2177 ext3_mark_inode_dirty(handle, inode); 2183 ext3_mark_inode_dirty(handle, inode);
2178 iput (inode); 2184 iput (inode);
2179 goto out_stop; 2185 goto out_stop;
@@ -2221,7 +2227,14 @@ retry:
2221 inc_nlink(inode); 2227 inc_nlink(inode);
2222 atomic_inc(&inode->i_count); 2228 atomic_inc(&inode->i_count);
2223 2229
2224 err = ext3_add_nondir(handle, dentry, inode); 2230 err = ext3_add_entry(handle, dentry, inode);
2231 if (!err) {
2232 ext3_mark_inode_dirty(handle, inode);
2233 d_instantiate(dentry, inode);
2234 } else {
2235 drop_nlink(inode);
2236 iput(inode);
2237 }
2225 ext3_journal_stop(handle); 2238 ext3_journal_stop(handle);
2226 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) 2239 if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries))
2227 goto retry; 2240 goto retry;