diff options
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/inode.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 1be31368e88..a682c267576 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c | |||
@@ -4069,7 +4069,7 @@ static struct inode *new_simple_dir(struct super_block *s, | |||
4069 | BTRFS_I(inode)->dummy_inode = 1; | 4069 | BTRFS_I(inode)->dummy_inode = 1; |
4070 | 4070 | ||
4071 | inode->i_ino = BTRFS_EMPTY_SUBVOL_DIR_OBJECTID; | 4071 | inode->i_ino = BTRFS_EMPTY_SUBVOL_DIR_OBJECTID; |
4072 | inode->i_op = &simple_dir_inode_operations; | 4072 | inode->i_op = &btrfs_dir_ro_inode_operations; |
4073 | inode->i_fop = &simple_dir_operations; | 4073 | inode->i_fop = &simple_dir_operations; |
4074 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; | 4074 | inode->i_mode = S_IFDIR | S_IRUGO | S_IWUSR | S_IXUGO; |
4075 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; | 4075 | inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; |
@@ -4140,14 +4140,18 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry) | |||
4140 | static int btrfs_dentry_delete(const struct dentry *dentry) | 4140 | static int btrfs_dentry_delete(const struct dentry *dentry) |
4141 | { | 4141 | { |
4142 | struct btrfs_root *root; | 4142 | struct btrfs_root *root; |
4143 | struct inode *inode = dentry->d_inode; | ||
4143 | 4144 | ||
4144 | if (!dentry->d_inode && !IS_ROOT(dentry)) | 4145 | if (!inode && !IS_ROOT(dentry)) |
4145 | dentry = dentry->d_parent; | 4146 | inode = dentry->d_parent->d_inode; |
4146 | 4147 | ||
4147 | if (dentry->d_inode) { | 4148 | if (inode) { |
4148 | root = BTRFS_I(dentry->d_inode)->root; | 4149 | root = BTRFS_I(inode)->root; |
4149 | if (btrfs_root_refs(&root->root_item) == 0) | 4150 | if (btrfs_root_refs(&root->root_item) == 0) |
4150 | return 1; | 4151 | return 1; |
4152 | |||
4153 | if (btrfs_ino(inode) == BTRFS_EMPTY_SUBVOL_DIR_OBJECTID) | ||
4154 | return 1; | ||
4151 | } | 4155 | } |
4152 | return 0; | 4156 | return 0; |
4153 | } | 4157 | } |