mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-12 21:57:43 +00:00
btrfs: fix file_offset for REQ_BTRFS_ONE_ORDERED bios that get split
[ Upstream commitc731cd0b6d
] 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, commit852eee62d3
("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:852eee62d3
("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>
This commit is contained in:
parent
82e3a2913b
commit
ad87179a20
1 changed files with 1 additions and 2 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue