mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-29 13:53:33 +00:00
for-5.19-rc6-tag
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEE8rQSAMVO+zA4DBdWxWXV+ddtWDsFAmLMiQQACgkQxWXV+ddt WDvBQg/+I1ebfW2DFY8kBwy7c1qKZWIhNx1VVk2AegIXvrW/Tos7wp5O6fi7p/jL d6k8zO/zFLlfiI4Ckmz3gt7cxaMTNXxr6+GQpNNm1b92Wdcy1a+3gquzcehT9Q10 ZB4ecPWzEDXgORvdBYG2eD2Z8PrsF0Wu88XRDiiJOBQLjZ+k2sVp8QvJlOllLDoC m7rPoq98jC6VpZwFJ+fGk2jC7y4+1QXrOuQMy7LRTe59Thp6wUFDDPtkKfr5scDC UxkctlUdInD7A6DVvPzwaBFNoT8UeEByGHcMd3KjjrTdmqSWW6k8FiF4ckZwA3zJ oPdJVzdC5a2W7t6BHw+t7VNmkKd+swnr2sVSGQ8eIzF7z3/JSqyYVwziOD1YzAdU QUmawWm4/SFvsbO8aoLrEKNbUiTgQwVbKzJh4Dhu9VJ43jeCwCX7pa/uZI4evgyG T0tuwm58bWCk4y1o1fcFYgf4JcVgK23F2vKckUFZeHoV3Q8R0DnPCCGTqs1qT5vY irZ9AIawmaR09JptMjjsAEjDA9qb16Ut/J6/anukyCgL610EyYZG7zb1WH1cUD1o zNXY6O/iKyNdiXj7V1fTMiG/M8hGDcFu4pOpBk3hFjHEXX9BefoVC0J5YzvCecPz isqboD5Lt1I4mrzac1X+serMYfVbFH6+tsEPBQBZf/o/a0u43jI= =Cxvn -----END PGP SIGNATURE----- Merge tag 'for-5.19-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux Pull btrfs fixes from David Sterba: "A more fixes that seem to me to be important enough to get merged before release: - in zoned mode, fix leak of a structure when reading zone info, this happens on normal path so this can be significant - in zoned mode, revert an optimization added in 5.19-rc1 to finish a zone when the capacity is full, but this is not reliable in all cases - try to avoid short reads for compressed data or inline files when it's a NOWAIT read, applications should handle that but there are two, qemu and mariadb, that are affected" * tag 'for-5.19-rc6-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: zoned: drop optimization of zone finish btrfs: zoned: fix a leaked bioc in read_zone_info btrfs: return -EAGAIN for NOWAIT dio reads/writes on compressed and inline extents
This commit is contained in:
commit
5a29232d87
2 changed files with 27 additions and 21 deletions
|
@ -7681,7 +7681,19 @@ static int btrfs_dio_iomap_begin(struct inode *inode, loff_t start,
|
|||
if (test_bit(EXTENT_FLAG_COMPRESSED, &em->flags) ||
|
||||
em->block_start == EXTENT_MAP_INLINE) {
|
||||
free_extent_map(em);
|
||||
ret = -ENOTBLK;
|
||||
/*
|
||||
* If we are in a NOWAIT context, return -EAGAIN in order to
|
||||
* fallback to buffered IO. This is not only because we can
|
||||
* block with buffered IO (no support for NOWAIT semantics at
|
||||
* the moment) but also to avoid returning short reads to user
|
||||
* space - this happens if we were able to read some data from
|
||||
* previous non-compressed extents and then when we fallback to
|
||||
* buffered IO, at btrfs_file_read_iter() by calling
|
||||
* filemap_read(), we fail to fault in pages for the read buffer,
|
||||
* in which case filemap_read() returns a short read (the number
|
||||
* of bytes previously read is > 0, so it does not return -EFAULT).
|
||||
*/
|
||||
ret = (flags & IOMAP_NOWAIT) ? -EAGAIN : -ENOTBLK;
|
||||
goto unlock_err;
|
||||
}
|
||||
|
||||
|
|
|
@ -1735,12 +1735,14 @@ static int read_zone_info(struct btrfs_fs_info *fs_info, u64 logical,
|
|||
ret = btrfs_map_sblock(fs_info, BTRFS_MAP_GET_READ_MIRRORS, logical,
|
||||
&mapped_length, &bioc);
|
||||
if (ret || !bioc || mapped_length < PAGE_SIZE) {
|
||||
btrfs_put_bioc(bioc);
|
||||
return -EIO;
|
||||
ret = -EIO;
|
||||
goto out_put_bioc;
|
||||
}
|
||||
|
||||
if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK)
|
||||
return -EINVAL;
|
||||
if (bioc->map_type & BTRFS_BLOCK_GROUP_RAID56_MASK) {
|
||||
ret = -EINVAL;
|
||||
goto out_put_bioc;
|
||||
}
|
||||
|
||||
nofs_flag = memalloc_nofs_save();
|
||||
nmirrors = (int)bioc->num_stripes;
|
||||
|
@ -1759,7 +1761,8 @@ static int read_zone_info(struct btrfs_fs_info *fs_info, u64 logical,
|
|||
break;
|
||||
}
|
||||
memalloc_nofs_restore(nofs_flag);
|
||||
|
||||
out_put_bioc:
|
||||
btrfs_put_bioc(bioc);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -1885,7 +1888,6 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
|
|||
{
|
||||
struct btrfs_fs_info *fs_info = block_group->fs_info;
|
||||
struct map_lookup *map;
|
||||
bool need_zone_finish;
|
||||
int ret = 0;
|
||||
int i;
|
||||
|
||||
|
@ -1942,12 +1944,6 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The block group is not fully allocated, so not fully written yet. We
|
||||
* need to send ZONE_FINISH command to free up an active zone.
|
||||
*/
|
||||
need_zone_finish = !btrfs_zoned_bg_is_full(block_group);
|
||||
|
||||
block_group->zone_is_active = 0;
|
||||
block_group->alloc_offset = block_group->zone_capacity;
|
||||
block_group->free_space_ctl->free_space = 0;
|
||||
|
@ -1963,7 +1959,6 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
|
|||
if (device->zone_info->max_active_zones == 0)
|
||||
continue;
|
||||
|
||||
if (need_zone_finish) {
|
||||
ret = blkdev_zone_mgmt(device->bdev, REQ_OP_ZONE_FINISH,
|
||||
physical >> SECTOR_SHIFT,
|
||||
device->zone_info->zone_size >> SECTOR_SHIFT,
|
||||
|
@ -1971,7 +1966,6 @@ static int do_zone_finish(struct btrfs_block_group *block_group, bool fully_writ
|
|||
|
||||
if (ret)
|
||||
return ret;
|
||||
}
|
||||
|
||||
btrfs_dev_clear_active_zone(device, physical);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue