Commit 8fc37ec5 authored by Al Viro's avatar Al Viro

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: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 32a7991b
...@@ -269,8 +269,8 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry, ...@@ -269,8 +269,8 @@ ecryptfs_create(struct inode *directory_inode, struct dentry *ecryptfs_dentry,
iput(ecryptfs_inode); iput(ecryptfs_inode);
goto out; goto out;
} }
d_instantiate(ecryptfs_dentry, ecryptfs_inode);
unlock_new_inode(ecryptfs_inode); unlock_new_inode(ecryptfs_inode);
d_instantiate(ecryptfs_dentry, ecryptfs_inode);
out: out:
return rc; return rc;
} }
......
...@@ -41,8 +41,8 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode) ...@@ -41,8 +41,8 @@ static inline int ext2_add_nondir(struct dentry *dentry, struct inode *inode)
{ {
int err = ext2_add_link(dentry, inode); int err = ext2_add_link(dentry, inode);
if (!err) { if (!err) {
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
} }
inode_dec_link_count(inode); inode_dec_link_count(inode);
...@@ -242,8 +242,8 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ...@@ -242,8 +242,8 @@ static int ext2_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
if (err) if (err)
goto out_fail; goto out_fail;
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
out: out:
return err; return err;
......
...@@ -1671,8 +1671,8 @@ static int ext3_add_nondir(handle_t *handle, ...@@ -1671,8 +1671,8 @@ static int ext3_add_nondir(handle_t *handle,
int err = ext3_add_entry(handle, dentry, inode); int err = ext3_add_entry(handle, dentry, inode);
if (!err) { if (!err) {
ext3_mark_inode_dirty(handle, inode); ext3_mark_inode_dirty(handle, inode);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
} }
drop_nlink(inode); drop_nlink(inode);
...@@ -1836,8 +1836,8 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode) ...@@ -1836,8 +1836,8 @@ static int ext3_mkdir(struct inode * dir, struct dentry * dentry, umode_t mode)
if (err) if (err)
goto out_clear_inode; goto out_clear_inode;
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
out_stop: out_stop:
brelse(dir_block); brelse(dir_block);
ext3_journal_stop(handle); ext3_journal_stop(handle);
......
...@@ -2072,8 +2072,8 @@ static int ext4_add_nondir(handle_t *handle, ...@@ -2072,8 +2072,8 @@ static int ext4_add_nondir(handle_t *handle,
int err = ext4_add_entry(handle, dentry, inode); int err = ext4_add_entry(handle, dentry, inode);
if (!err) { if (!err) {
ext4_mark_inode_dirty(handle, inode); ext4_mark_inode_dirty(handle, inode);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
} }
drop_nlink(inode); drop_nlink(inode);
...@@ -2249,8 +2249,8 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode) ...@@ -2249,8 +2249,8 @@ static int ext4_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
err = ext4_mark_inode_dirty(handle, dir); err = ext4_mark_inode_dirty(handle, dir);
if (err) if (err)
goto out_clear_inode; goto out_clear_inode;
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
out_stop: out_stop:
brelse(dir_block); brelse(dir_block);
ext4_journal_stop(handle); ext4_journal_stop(handle);
......
...@@ -226,8 +226,8 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry, ...@@ -226,8 +226,8 @@ static int jffs2_create(struct inode *dir_i, struct dentry *dentry,
__func__, inode->i_ino, inode->i_mode, inode->i_nlink, __func__, inode->i_ino, inode->i_mode, inode->i_nlink,
f->inocache->pino_nlink, inode->i_mapping->nrpages); f->inocache->pino_nlink, inode->i_mapping->nrpages);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
fail: fail:
...@@ -446,8 +446,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char ...@@ -446,8 +446,8 @@ static int jffs2_symlink (struct inode *dir_i, struct dentry *dentry, const char
mutex_unlock(&dir_f->sem); mutex_unlock(&dir_f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
fail: fail:
...@@ -591,8 +591,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode ...@@ -591,8 +591,8 @@ static int jffs2_mkdir (struct inode *dir_i, struct dentry *dentry, umode_t mode
mutex_unlock(&dir_f->sem); mutex_unlock(&dir_f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
fail: fail:
...@@ -766,8 +766,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode ...@@ -766,8 +766,8 @@ static int jffs2_mknod (struct inode *dir_i, struct dentry *dentry, umode_t mode
mutex_unlock(&dir_f->sem); mutex_unlock(&dir_f->sem);
jffs2_complete_reservation(c); jffs2_complete_reservation(c);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
return 0; return 0;
fail: fail:
......
...@@ -176,8 +176,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode, ...@@ -176,8 +176,8 @@ static int jfs_create(struct inode *dip, struct dentry *dentry, umode_t mode,
unlock_new_inode(ip); unlock_new_inode(ip);
iput(ip); iput(ip);
} else { } else {
d_instantiate(dentry, ip);
unlock_new_inode(ip); unlock_new_inode(ip);
d_instantiate(dentry, ip);
} }
out2: out2:
...@@ -309,8 +309,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode) ...@@ -309,8 +309,8 @@ static int jfs_mkdir(struct inode *dip, struct dentry *dentry, umode_t mode)
unlock_new_inode(ip); unlock_new_inode(ip);
iput(ip); iput(ip);
} else { } else {
d_instantiate(dentry, ip);
unlock_new_inode(ip); unlock_new_inode(ip);
d_instantiate(dentry, ip);
} }
out2: out2:
...@@ -1043,8 +1043,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry, ...@@ -1043,8 +1043,8 @@ static int jfs_symlink(struct inode *dip, struct dentry *dentry,
unlock_new_inode(ip); unlock_new_inode(ip);
iput(ip); iput(ip);
} else { } else {
d_instantiate(dentry, ip);
unlock_new_inode(ip); unlock_new_inode(ip);
d_instantiate(dentry, ip);
} }
out2: out2:
...@@ -1424,8 +1424,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry, ...@@ -1424,8 +1424,8 @@ static int jfs_mknod(struct inode *dir, struct dentry *dentry,
unlock_new_inode(ip); unlock_new_inode(ip);
iput(ip); iput(ip);
} else { } else {
d_instantiate(dentry, ip);
unlock_new_inode(ip); unlock_new_inode(ip);
d_instantiate(dentry, ip);
} }
out1: out1:
......
...@@ -634,8 +634,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod ...@@ -634,8 +634,8 @@ static int reiserfs_create(struct inode *dir, struct dentry *dentry, umode_t mod
reiserfs_update_inode_transaction(inode); reiserfs_update_inode_transaction(inode);
reiserfs_update_inode_transaction(dir); reiserfs_update_inode_transaction(dir);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
retval = journal_end(&th, dir->i_sb, jbegin_count); retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed: out_failed:
...@@ -712,8 +712,8 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -712,8 +712,8 @@ static int reiserfs_mknod(struct inode *dir, struct dentry *dentry, umode_t mode
goto out_failed; goto out_failed;
} }
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
retval = journal_end(&th, dir->i_sb, jbegin_count); retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed: out_failed:
...@@ -800,8 +800,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode ...@@ -800,8 +800,8 @@ static int reiserfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode
// the above add_entry did not update dir's stat data // the above add_entry did not update dir's stat data
reiserfs_update_sd(&th, dir); reiserfs_update_sd(&th, dir);
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
retval = journal_end(&th, dir->i_sb, jbegin_count); retval = journal_end(&th, dir->i_sb, jbegin_count);
out_failed: out_failed:
reiserfs_write_unlock_once(dir->i_sb, lock_depth); reiserfs_write_unlock_once(dir->i_sb, lock_depth);
...@@ -1096,8 +1096,8 @@ static int reiserfs_symlink(struct inode *parent_dir, ...@@ -1096,8 +1096,8 @@ static int reiserfs_symlink(struct inode *parent_dir,
goto out_failed; goto out_failed;
} }
d_instantiate(dentry, inode);
unlock_new_inode(inode); unlock_new_inode(inode);
d_instantiate(dentry, inode);
retval = journal_end(&th, parent_dir->i_sb, jbegin_count); retval = journal_end(&th, parent_dir->i_sb, jbegin_count);
out_failed: out_failed:
reiserfs_write_unlock(parent_dir->i_sb); reiserfs_write_unlock(parent_dir->i_sb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment