diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-19 01:18:15 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-07-22 16:00:58 -0400 |
commit | 8fc37ec54cd8e37193b0d42809b785ff19661c34 (patch) | |
tree | 12040128b054dc1b163433358b0fd2b8ec843762 /fs | |
parent | 32a7991b6a9c758e4e2b8166c5e1cc7563c3dcde (diff) |
don't expose I_NEW inodes via dentry->d_inode
d_instantiate(dentry, inode);
unlock_new_inode(inode);
is a bad idea; do it the other way round...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ecryptfs/inode.c | 2 | ||||
-rw-r--r-- | fs/ext2/namei.c | 4 | ||||
-rw-r--r-- | fs/ext3/namei.c | 4 | ||||
-rw-r--r-- | fs/ext4/namei.c | 4 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 8 | ||||
-rw-r--r-- | fs/jfs/namei.c | 8 | ||||
-rw-r--r-- | fs/reiserfs/namei.c | 8 |
7 files changed, 19 insertions, 19 deletions
diff --git a/fs/ecryptfs/inode.c b/fs/ecryptfs/inode.c index da52cdbe8388..ffa2be57804d 100644 --- a/fs/ecryptfs/inode.c +++ b/fs/ecryptfs/inode.c | |||
@@ -269,8 +269,8 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, | |||
269 | iput(ecryptfs_inode); | 269 | iput(ecryptfs_inode); |
270 | goto out; | 270 | goto out; |
271 | } | 271 | } |
272 | d_instantiate(ecryptfs_dentry, ecryptfs_inode); | ||
273 | unlock_new_inode(ecryptfs_inode); | 272 | unlock_new_inode(ecryptfs_inode); |
273 | d_instantiate(ecryptfs_dentry, ecryptfs_inode); | ||
274 | out: | 274 | out: |
275 | return rc; | 275 | return rc; |
276 | } | 276 | } |
diff --git a/fs/ext2/namei.c b/fs/ext2/namei.c index 9ba7de0e5903..73b0d9519836 100644 --- a/fs/ext2/namei.c +++ b/fs/ext2/namei.c | |||
@@ -41,8 +41,8 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) | |||
41 | { | 41 | { |
42 | int err = ext2_add_link(dentry, inode); | 42 | int err = ext2_add_link(dentry, inode); |
43 | if (!err) { | 43 | if (!err) { |
44 | d_instantiate(dentry, inode); | ||
45 | unlock_new_inode(inode); | 44 | unlock_new_inode(inode); |
45 | d_instantiate(dentry, inode); | ||
46 | return 0; | 46 | return 0; |
47 | } | 47 | } |
48 | inode_dec_link_count(inode); | 48 | inode_dec_link_count(inode); |
@@ -242,8 +242,8 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) | |||
242 | if (err) | 242 | if (err) |
243 | goto out_fail; | 243 | goto out_fail; |
244 | 244 | ||
245 | d_instantiate(dentry, inode); | ||
246 | unlock_new_inode(inode); | 245 | unlock_new_inode(inode); |
246 | d_instantiate(dentry, inode); | ||
247 | out: | 247 | out: |
248 | return err; | 248 | return err; |
249 | 249 | ||
diff --git a/fs/ext3/namei.c b/fs/ext3/namei.c index 85286dbe2753..8f4fddac01a6 100644 --- a/fs/ext3/namei.c +++ b/fs/ext3/namei.c | |||
@@ -1671,8 +1671,8 @@ static int ext3_add_nondir(handle_t *handle, | |||
1671 | int err = ext3_add_entry(handle, dentry, inode); | 1671 | int err = ext3_add_entry(handle, dentry, inode); |
1672 | if (!err) { | 1672 | if (!err) { |
1673 | ext3_mark_inode_dirty(handle, inode); | 1673 | ext3_mark_inode_dirty(handle, inode); |
1674 | d_instantiate(dentry, inode); | ||
1675 | unlock_new_inode(inode); | 1674 | unlock_new_inode(inode); |
1675 | d_instantiate(dentry, inode); | ||
1676 | return 0; | 1676 | return 0; |
1677 | } | 1677 | } |
1678 | drop_nlink(inode); | 1678 | drop_nlink(inode); |
@@ -1836,8 +1836,8 @@ out_clear_inode: | |||
1836 | if (err) | 1836 | if (err) |
1837 | goto out_clear_inode; | 1837 | goto out_clear_inode; |
1838 | 1838 | ||
1839 | d_instantiate(dentry, inode); | ||
1840 | unlock_new_inode(inode); | 1839 | unlock_new_inode(inode); |
1840 | d_instantiate(dentry, inode); | ||
1841 | out_stop: | 1841 | out_stop: |
1842 | brelse(dir_block); | 1842 | brelse(dir_block); |
1843 | ext3_journal_stop(handle); | 1843 | ext3_journal_stop(handle); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index eca3e48a62f8..d0d3f0e87f99 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -2072,8 +2072,8 @@ static int ext4_add_nondir(handle_t *handle, | |||
2072 | int err = ext4_add_entry(handle, dentry, inode); | 2072 | int err = ext4_add_entry(handle, dentry, inode); |
2073 | if (!err) { | 2073 | if (!err) { |
2074 | ext4_mark_inode_dirty(handle, inode); | 2074 | ext4_mark_inode_dirty(handle, inode); |
2075 | d_instantiate(dentry, inode); | ||
2076 | unlock_new_inode(inode); | 2075 | unlock_new_inode(inode); |
2076 | d_instantiate(dentry, inode); | ||
2077 | return 0; | 2077 | return 0; |
2078 | } | 2078 | } |
2079 | drop_nlink(inode); | 2079 | drop_nlink(inode); |
@@ -2249,8 +2249,8 @@ out_clear_inode: | |||
2249 | err = ext4_mark_inode_dirty(handle, dir); | 2249 | err = ext4_mark_inode_dirty(handle, dir); |
2250 | if (err) | 2250 | if (err) |
2251 | goto out_clear_inode; | 2251 | goto out_clear_inode; |
2252 | d_instantiate(dentry, inode); | ||
2253 | unlock_new_inode(inode); | 2252 | unlock_new_inode(inode); |
2253 | d_instantiate(dentry, inode); | ||
2254 | out_stop: | 2254 | out_stop: |
2255 | brelse(dir_block); | 2255 | brelse(dir_block); |
2256 | ext4_journal_stop(handle); | 2256 | ext4_journal_stop(handle); |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 23245191c5b5..ad7774d32095 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -226,8 +226,8 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, | |||
226 | __func__, inode->i_ino, inode->i_mode, inode->i_nlink, | 226 | __func__, inode->i_ino, inode->i_mode, inode->i_nlink, |
227 | f->inocache->pino_nlink, inode->i_mapping->nrpages); | 227 | f->inocache->pino_nlink, inode->i_mapping->nrpages); |
228 | 228 | ||
229 | d_instantiate(dentry, inode); | ||
230 | unlock_new_inode(inode); | 229 | unlock_new_inode(inode); |
230 | d_instantiate(dentry, inode); | ||
231 | return 0; | 231 | return 0; |
232 | 232 | ||
233 | fail: | 233 | fail: |
@@ -446,8 +446,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char | |||
446 | mutex_unlock(&dir_f->sem); | 446 | mutex_unlock(&dir_f->sem); |
447 | jffs2_complete_reservation(c); | 447 | jffs2_complete_reservation(c); |
448 | 448 | ||
449 | d_instantiate(dentry, inode); | ||
450 | unlock_new_inode(inode); | 449 | unlock_new_inode(inode); |
450 | d_instantiate(dentry, inode); | ||
451 | return 0; | 451 | return 0; |
452 | 452 | ||
453 | fail: | 453 | fail: |
@@ -591,8 +591,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode | |||
591 | mutex_unlock(&dir_f->sem); | 591 | mutex_unlock(&dir_f->sem); |
592 | jffs2_complete_reservation(c); | 592 | jffs2_complete_reservation(c); |
593 | 593 | ||
594 | d_instantiate(dentry, inode); | ||
595 | unlock_new_inode(inode); | 594 | unlock_new_inode(inode); |
595 | d_instantiate(dentry, inode); | ||
596 | return 0; | 596 | return 0; |
597 | 597 | ||
598 | fail: | 598 | fail: |
@@ -766,8 +766,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode | |||
766 | mutex_unlock(&dir_f->sem); | 766 | mutex_unlock(&dir_f->sem); |
767 | jffs2_complete_reservation(c); | 767 | jffs2_complete_reservation(c); |
768 | 768 | ||
769 | d_instantiate(dentry, inode); | ||
770 | unlock_new_inode(inode); | 769 | unlock_new_inode(inode); |
770 | d_instantiate(dentry, inode); | ||
771 | return 0; | 771 | return 0; |
772 | 772 | ||
773 | fail: | 773 | fail: |
diff --git a/fs/jfs/namei.c b/fs/jfs/namei.c index c426293e16c1..3b91a7ad6086 100644 --- a/fs/jfs/namei.c +++ b/fs/jfs/namei.c | |||
@@ -176,8 +176,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, | |||
176 | unlock_new_inode(ip); | 176 | unlock_new_inode(ip); |
177 | iput(ip); | 177 | iput(ip); |
178 | } else { | 178 | } else { |
179 | d_instantiate(dentry, ip); | ||
180 | unlock_new_inode(ip); | 179 | unlock_new_inode(ip); |
180 | d_instantiate(dentry, ip); | ||
181 | } | 181 | } |
182 | 182 | ||
183 | out2: | 183 | out2: |
@@ -309,8 +309,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) | |||
309 | unlock_new_inode(ip); | 309 | unlock_new_inode(ip); |
310 | iput(ip); | 310 | iput(ip); |
311 | } else { | 311 | } else { |
312 | d_instantiate(dentry, ip); | ||
313 | unlock_new_inode(ip); | 312 | unlock_new_inode(ip); |
313 | d_instantiate(dentry, ip); | ||
314 | } | 314 | } |
315 | 315 | ||
316 | out2: | 316 | out2: |
@@ -1043,8 +1043,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, | |||
1043 | unlock_new_inode(ip); | 1043 | unlock_new_inode(ip); |
1044 | iput(ip); | 1044 | iput(ip); |
1045 | } else { | 1045 | } else { |
1046 | d_instantiate(dentry, ip); | ||
1047 | unlock_new_inode(ip); | 1046 | unlock_new_inode(ip); |
1047 | d_instantiate(dentry, ip); | ||
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | out2: | 1050 | out2: |
@@ -1424,8 +1424,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, | |||
1424 | unlock_new_inode(ip); | 1424 | unlock_new_inode(ip); |
1425 | iput(ip); | 1425 | iput(ip); |
1426 | } else { | 1426 | } else { |
1427 | d_instantiate(dentry, ip); | ||
1428 | unlock_new_inode(ip); | 1427 | unlock_new_inode(ip); |
1428 | d_instantiate(dentry, ip); | ||
1429 | } | 1429 | } |
1430 | 1430 | ||
1431 | out1: | 1431 | out1: |
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c index 3916be1a330b..8567fb847601 100644 --- a/fs/reiserfs/namei.c +++ b/fs/reiserfs/namei.c | |||
@@ -634,8 +634,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod | |||
634 | reiserfs_update_inode_transaction(inode); | 634 | reiserfs_update_inode_transaction(inode); |
635 | reiserfs_update_inode_transaction(dir); | 635 | reiserfs_update_inode_transaction(dir); |
636 | 636 | ||
637 | d_instantiate(dentry, inode); | ||
638 | unlock_new_inode(inode); | 637 | unlock_new_inode(inode); |
638 | d_instantiate(dentry, inode); | ||
639 | retval = journal_end(&th, dir->i_sb, jbegin_count); | 639 | retval = journal_end(&th, dir->i_sb, jbegin_count); |
640 | 640 | ||
641 | out_failed: | 641 | out_failed: |
@@ -712,8 +712,8 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode | |||
712 | goto out_failed; | 712 | goto out_failed; |
713 | } | 713 | } |
714 | 714 | ||
715 | d_instantiate(dentry, inode); | ||
716 | unlock_new_inode(inode); | 715 | unlock_new_inode(inode); |
716 | d_instantiate(dentry, inode); | ||
717 | retval = journal_end(&th, dir->i_sb, jbegin_count); | 717 | retval = journal_end(&th, dir->i_sb, jbegin_count); |
718 | 718 | ||
719 | out_failed: | 719 | out_failed: |
@@ -800,8 +800,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode | |||
800 | // the above add_entry did not update dir's stat data | 800 | // the above add_entry did not update dir's stat data |
801 | reiserfs_update_sd(&th, dir); | 801 | reiserfs_update_sd(&th, dir); |
802 | 802 | ||
803 | d_instantiate(dentry, inode); | ||
804 | unlock_new_inode(inode); | 803 | unlock_new_inode(inode); |
804 | d_instantiate(dentry, inode); | ||
805 | retval = journal_end(&th, dir->i_sb, jbegin_count); | 805 | retval = journal_end(&th, dir->i_sb, jbegin_count); |
806 | out_failed: | 806 | out_failed: |
807 | reiserfs_write_unlock_once(dir->i_sb, lock_depth); | 807 | reiserfs_write_unlock_once(dir->i_sb, lock_depth); |
@@ -1096,8 +1096,8 @@ static int reiserfs_symlink(struct inode *parent_dir, | |||
1096 | goto out_failed; | 1096 | goto out_failed; |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | d_instantiate(dentry, inode); | ||
1100 | unlock_new_inode(inode); | 1099 | unlock_new_inode(inode); |
1100 | d_instantiate(dentry, inode); | ||
1101 | retval = journal_end(&th, parent_dir->i_sb, jbegin_count); | 1101 | retval = journal_end(&th, parent_dir->i_sb, jbegin_count); |
1102 | out_failed: | 1102 | out_failed: |
1103 | reiserfs_write_unlock(parent_dir->i_sb); | 1103 | reiserfs_write_unlock(parent_dir->i_sb); |