]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split
authorChristoph Hellwig <hch@lst.de>
Wed, 31 May 2023 07:53:54 +0000 (09:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Jul 2023 17:39:23 +0000 (19:39 +0200)
commitd62835bafe2141d300fe836c4acec905f97b31ed
treed99bda5fe4b7d4fc32001c6d5d93868a0254bdb2
parent15d7102ee2d32181d9ed857c3454488c08ba1405
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@wdc.com>
Reviewed-by: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/btrfs/bio.c