diff options
Diffstat (limited to 'fs/ext3/namei.c')
-rw-r--r-- | fs/ext3/namei.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 3e5edc92aa0b..1dd2abe6313e 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); | ||
1803 | out_stop: | 1808 | out_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)) |
@@ -2170,10 +2175,10 @@ retry: | |||
2170 | * We have a transaction open. All is sweetness. It also sets | 2175 | * We have a transaction open. All is sweetness. It also sets |
2171 | * i_size in generic_commit_write(). | 2176 | * i_size in generic_commit_write(). |
2172 | */ | 2177 | */ |
2173 | err = __page_symlink(inode, symname, l, | 2178 | err = __page_symlink(inode, symname, l, 1); |
2174 | mapping_gfp_mask(inode->i_mapping) & ~__GFP_FS); | ||
2175 | if (err) { | 2179 | if (err) { |
2176 | drop_nlink(inode); | 2180 | drop_nlink(inode); |
2181 | unlock_new_inode(inode); | ||
2177 | ext3_mark_inode_dirty(handle, inode); | 2182 | ext3_mark_inode_dirty(handle, inode); |
2178 | iput (inode); | 2183 | iput (inode); |
2179 | goto out_stop; | 2184 | goto out_stop; |
@@ -2221,7 +2226,14 @@ retry: | |||
2221 | inc_nlink(inode); | 2226 | inc_nlink(inode); |
2222 | atomic_inc(&inode->i_count); | 2227 | atomic_inc(&inode->i_count); |
2223 | 2228 | ||
2224 | err = ext3_add_nondir(handle, dentry, inode); | 2229 | err = ext3_add_entry(handle, dentry, inode); |
2230 | if (!err) { | ||
2231 | ext3_mark_inode_dirty(handle, inode); | ||
2232 | d_instantiate(dentry, inode); | ||
2233 | } else { | ||
2234 | drop_nlink(inode); | ||
2235 | iput(inode); | ||
2236 | } | ||
2225 | ext3_journal_stop(handle); | 2237 | ext3_journal_stop(handle); |
2226 | if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) | 2238 | if (err == -ENOSPC && ext3_should_retry_alloc(dir->i_sb, &retries)) |
2227 | goto retry; | 2239 | goto retry; |