]> git.hungrycats.org Git - linux/commitdiff
btrfs: increase output size for LOGICAL_INO_V2 ioctl
authorZygo Blaxell <ce3g8jdj@umail.furryterror.org>
Wed, 20 Sep 2017 04:35:46 +0000 (00:35 -0400)
committerZygo Blaxell <zblaxell@thirteen.furryterror.org>
Tue, 26 Sep 2017 04:36:51 +0000 (00:36 -0400)
Build-server workloads have hundreds of references per file after dedup.
Multiply by a few snapshots and we quickly exhaust the limit of 2730
references per extent that can fit into a 64K buffer.

Raise the limit to 16M to be consistent with other btrfs ioctls
(e.g. TREE_SEARCH_V2, FILE_EXTENT_SAME).

To minimize surprising userspace behavior, apply this change only to
the LOGICAL_INO_V2 ioctl.

Signed-off-by: Zygo Blaxell <ce3g8jdj@umail.furryterror.org>
(cherry picked from commit 82d024eaed9935d82e7ebc7942c0d02c9a6a10af)

fs/btrfs/ioctl.c

index af17e41e592d8f99940e70c6f1bc8ad6a6ce44fd..217c0af5548a70e2efb2c459269d67b09ce17aba 100644 (file)
@@ -4560,6 +4560,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
 
        if (version == 1) {
                ignore_offset = false;
+               size = min_t(u32, loi->size, SZ_64K);
        } else {
                /* All reserved bits must be 0 for now */
                if (memchr_inv(loi->reserved, 0, sizeof(loi->reserved))) {
@@ -4572,6 +4573,7 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
                        goto out_loi;
                }
                ignore_offset = loi->flags & BTRFS_LOGICAL_INO_ARGS_IGNORE_OFFSET;
+               size = min_t(u32, loi->size, SZ_16M);
        }
 
        path = btrfs_alloc_path();
@@ -4580,7 +4582,6 @@ static long btrfs_ioctl_logical_to_ino(struct btrfs_fs_info *fs_info,
                goto out;
        }
 
-       size = min_t(u32, loi->size, SZ_16M);
        inodes = init_data_container(size);
        if (IS_ERR(inodes)) {
                ret = PTR_ERR(inodes);