]> git.hungrycats.org Git - linux/commitdiff
btrfs: EXPERIMENT: wrap entire LOGICAL_TO_INO in transaction
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 5 Jul 2019 05:17:06 +0000 (01:17 -0400)
committerZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Fri, 5 Jul 2019 05:17:06 +0000 (01:17 -0400)
fs/btrfs/ioctl.c

index 679303bf8e7414a828538aee793ad202047e34f3..b5c398b600d7c118e31ed3a96396afd1a20d5dbf 100644 (file)
@@ -4591,6 +4591,8 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
        struct btrfs_data_container *inodes = NULL;
        struct btrfs_path *path = NULL;
        bool ignore_offset;
+       struct btrfs_trans_handle *trans;
+       struct btrfs_root *root = fs_info->tree_root;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -4630,8 +4632,18 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
                goto out;
        }
 
+       trans = btrfs_join_transaction(root);
+       if (IS_ERR(trans)) {
+               btrfs_info(fs_info, "btrfs_join_transaction failed, trans = %p", trans);
+               trans = NULL;
+       }
+
        ret = iterate_inodes_from_logical(loi->logical, fs_info, path,
                                          build_ino_list, inodes, ignore_offset);
+
+       if (trans)
+               btrfs_end_transaction(trans);
+
        if (ret == -EINVAL)
                ret = -ENOENT;
        if (ret < 0)