This is a note to let you know that I've just added the patch titled btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split to the 6.4-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: btrfs-fix-file_offset-for-req_btrfs_one_ordered-bios.patch and it can be found in the queue-6.4 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit aed7b096ff1a7875fffa4dcdaeff78af197d7828 Author: Christoph Hellwig <hch@xxxxxx> Date: Wed May 31 09:53:54 2023 +0200 btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split [ Upstream commit c731cd0b6d255e4855a7cac9f276864032ab2387 ] If a bio gets split, it needs to have a proper file_offset for checksum validation and repair to work properly. Based on feedback from Josef, commit 852eee62d31a ("btrfs: allow btrfs_submit_bio to split bios") skipped this adjustment for ONE_ORDERED bios. But if we actually ever need to split a ONE_ORDERED read bio, this will lead to a wrong file offset in the repair code. Right now the only user of the file_offset is logging of an error message so this is mostly harmless, but the wrong offset might be more problematic for additional users in the future. Fixes: 852eee62d31a ("btrfs: allow btrfs_submit_bio to split bios") Reviewed-by: Johannes Thumshirn <johannes.thumshirn@xxxxxxx> Reviewed-by: Josef Bacik <josef@xxxxxxxxxxxxxx> Signed-off-by: Christoph Hellwig <hch@xxxxxx> Reviewed-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: David Sterba <dsterba@xxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c index b3ad0f51e6162..b86faf8126e77 100644 --- a/fs/btrfs/bio.c +++ b/fs/btrfs/bio.c @@ -95,8 +95,7 @@ static struct btrfs_bio *btrfs_split_bio(struct btrfs_fs_info *fs_info, btrfs_bio_init(bbio, fs_info, NULL, orig_bbio); bbio->inode = orig_bbio->inode; bbio->file_offset = orig_bbio->file_offset; - if (!(orig_bbio->bio.bi_opf & REQ_BTRFS_ONE_ORDERED)) - orig_bbio->file_offset += map_length; + orig_bbio->file_offset += map_length; atomic_inc(&orig_bbio->pending_ios); return bbio;