switch btrfs, close races
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 20 Dec 2010 15:56:06 +0000 (10:56 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Thu, 13 Jan 2011 01:02:47 +0000 (20:02 -0500)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/btrfs/export.c
fs/btrfs/inode.c
fs/btrfs/super.c

index 0ccf9a8afcdf0a9143d740c39051de3833c96701..9786963b07e5be25914a15c2d863da2d13700d33 100644 (file)
@@ -65,7 +65,6 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
 {
        struct btrfs_fs_info *fs_info = btrfs_sb(sb)->fs_info;
        struct btrfs_root *root;
-       struct dentry *dentry;
        struct inode *inode;
        struct btrfs_key key;
        int index;
@@ -108,10 +107,7 @@ static struct dentry *btrfs_get_dentry(struct super_block *sb, u64 objectid,
                return ERR_PTR(-ESTALE);
        }
 
-       dentry = d_obtain_alias(inode);
-       if (!IS_ERR(dentry))
-               d_set_d_op(dentry, &btrfs_dentry_operations);
-       return dentry;
+       return d_obtain_alias(inode);
 fail:
        srcu_read_unlock(&fs_info->subvol_srcu, index);
        return ERR_PTR(err);
@@ -166,7 +162,6 @@ static struct dentry *btrfs_fh_to_dentry(struct super_block *sb, struct fid *fh,
 static struct dentry *btrfs_get_parent(struct dentry *child)
 {
        struct inode *dir = child->d_inode;
-       struct dentry *dentry;
        struct btrfs_root *root = BTRFS_I(dir)->root;
        struct btrfs_path *path;
        struct extent_buffer *leaf;
@@ -223,10 +218,7 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
 
        key.type = BTRFS_INODE_ITEM_KEY;
        key.offset = 0;
-       dentry = d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
-       if (!IS_ERR(dentry))
-               d_set_d_op(dentry, &btrfs_dentry_operations);
-       return dentry;
+       return d_obtain_alias(btrfs_iget(root->fs_info->sb, &key, root, NULL));
 fail:
        btrfs_free_path(path);
        return ERR_PTR(ret);
index a0ff46a478953fa118e342e9684e5e869c3d3615..f870aefc59dd5545f2a908a0be9fc5787d6ce4ae 100644 (file)
@@ -4084,8 +4084,6 @@ struct inode *btrfs_lookup_dentry(struct inode *dir, struct dentry *dentry)
        int index;
        int ret;
 
-       d_set_d_op(dentry, &btrfs_dentry_operations);
-
        if (dentry->d_name.len > BTRFS_NAME_LEN)
                return ERR_PTR(-ENAMETOOLONG);
 
index 883c6fa1367eb866002d7f67d3ae2ce6497f4367..22acdaa78ce1fd539c8a5a5b5420c718e1a5d675 100644 (file)
@@ -460,6 +460,7 @@ static int btrfs_fill_super(struct super_block *sb,
        sb->s_maxbytes = MAX_LFS_FILESIZE;
        sb->s_magic = BTRFS_SUPER_MAGIC;
        sb->s_op = &btrfs_super_ops;
+       sb->s_d_op = &btrfs_dentry_operations;
        sb->s_export_op = &btrfs_export_ops;
        sb->s_xattr = btrfs_xattr_handlers;
        sb->s_time_gran = 1;