aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/btrfs/inode.c31
1 files changed, 26 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index 4a31493d97ac..d4a9195c7f0d 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -4596,11 +4596,18 @@ static int btrfs_mknod(struct inode *dir, struct dentry *dentry,
4596 goto out_unlock; 4596 goto out_unlock;
4597 } 4597 }
4598 4598
4599 /*
4600 * If the active LSM wants to access the inode during
4601 * d_instantiate it needs these. Smack checks to see
4602 * if the filesystem supports xattrs by looking at the
4603 * ops vector.
4604 */
4605
4606 inode->i_op = &btrfs_special_inode_operations;
4599 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 4607 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
4600 if (err) 4608 if (err)
4601 drop_inode = 1; 4609 drop_inode = 1;
4602 else { 4610 else {
4603 inode->i_op = &btrfs_special_inode_operations;
4604 init_special_inode(inode, inode->i_mode, rdev); 4611 init_special_inode(inode, inode->i_mode, rdev);
4605 btrfs_update_inode(trans, root, inode); 4612 btrfs_update_inode(trans, root, inode);
4606 } 4613 }
@@ -4654,14 +4661,21 @@ static int btrfs_create(struct inode *dir, struct dentry *dentry,
4654 goto out_unlock; 4661 goto out_unlock;
4655 } 4662 }
4656 4663
4664 /*
4665 * If the active LSM wants to access the inode during
4666 * d_instantiate it needs these. Smack checks to see
4667 * if the filesystem supports xattrs by looking at the
4668 * ops vector.
4669 */
4670 inode->i_fop = &btrfs_file_operations;
4671 inode->i_op = &btrfs_file_inode_operations;
4672
4657 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 4673 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
4658 if (err) 4674 if (err)
4659 drop_inode = 1; 4675 drop_inode = 1;
4660 else { 4676 else {
4661 inode->i_mapping->a_ops = &btrfs_aops; 4677 inode->i_mapping->a_ops = &btrfs_aops;
4662 inode->i_mapping->backing_dev_info = &root->fs_info->bdi; 4678 inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
4663 inode->i_fop = &btrfs_file_operations;
4664 inode->i_op = &btrfs_file_inode_operations;
4665 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; 4679 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
4666 } 4680 }
4667out_unlock: 4681out_unlock:
@@ -7117,14 +7131,21 @@ static int btrfs_symlink(struct inode *dir, struct dentry *dentry,
7117 goto out_unlock; 7131 goto out_unlock;
7118 } 7132 }
7119 7133
7134 /*
7135 * If the active LSM wants to access the inode during
7136 * d_instantiate it needs these. Smack checks to see
7137 * if the filesystem supports xattrs by looking at the
7138 * ops vector.
7139 */
7140 inode->i_fop = &btrfs_file_operations;
7141 inode->i_op = &btrfs_file_inode_operations;
7142
7120 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index); 7143 err = btrfs_add_nondir(trans, dir, dentry, inode, 0, index);
7121 if (err) 7144 if (err)
7122 drop_inode = 1; 7145 drop_inode = 1;
7123 else { 7146 else {
7124 inode->i_mapping->a_ops = &btrfs_aops; 7147 inode->i_mapping->a_ops = &btrfs_aops;
7125 inode->i_mapping->backing_dev_info = &root->fs_info->bdi; 7148 inode->i_mapping->backing_dev_info = &root->fs_info->bdi;
7126 inode->i_fop = &btrfs_file_operations;
7127 inode->i_op = &btrfs_file_inode_operations;
7128 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops; 7149 BTRFS_I(inode)->io_tree.ops = &btrfs_extent_io_ops;
7129 } 7150 }
7130 if (drop_inode) 7151 if (drop_inode)