[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220504153127.384584893@linuxfoundation.org>
Date: Wed, 4 May 2022 18:47:10 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org,
Johannes Thumshirn <johannes.thumshirn@....com>,
Naohiro Aota <naohiro.aota@....com>, Qu Wenruo <wqu@...e.com>,
Sweet Tea Dorminy <sweettea-kernel@...miny.me>,
Christoph Hellwig <hch@....de>, David Sterba <dsterba@...e.com>
Subject: [PATCH 5.17 192/225] btrfs: fix direct I/O writes for split bios on zoned devices
From: Christoph Hellwig <hch@....de>
commit 0fdf977d4576ee0decd612e22f6a837a239573cc upstream.
When a bio is split in btrfs_submit_direct, dip->file_offset contains
the file offset for the first bio. But this means the start value used
in btrfs_end_dio_bio to record the write location for zone devices is
incorrect for subsequent bios.
CC: stable@...r.kernel.org # 5.16+
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@....com>
Reviewed-by: Naohiro Aota <naohiro.aota@....com>
Reviewed-by: Qu Wenruo <wqu@...e.com>
Reviewed-by: Sweet Tea Dorminy <sweettea-kernel@...miny.me>
Signed-off-by: Christoph Hellwig <hch@....de>
Signed-off-by: David Sterba <dsterba@...e.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
fs/btrfs/inode.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7845,6 +7845,7 @@ static blk_status_t btrfs_submit_bio_sta
static void btrfs_end_dio_bio(struct bio *bio)
{
struct btrfs_dio_private *dip = bio->bi_private;
+ struct btrfs_bio *bbio = btrfs_bio(bio);
blk_status_t err = bio->bi_status;
if (err)
@@ -7855,12 +7856,12 @@ static void btrfs_end_dio_bio(struct bio
bio->bi_iter.bi_size, err);
if (bio_op(bio) == REQ_OP_READ)
- err = btrfs_check_read_dio_bio(dip, btrfs_bio(bio), !err);
+ err = btrfs_check_read_dio_bio(dip, bbio, !err);
if (err)
dip->dio_bio->bi_status = err;
- btrfs_record_physical_zoned(dip->inode, dip->file_offset, bio);
+ btrfs_record_physical_zoned(dip->inode, bbio->file_offset, bio);
bio_put(bio);
btrfs_dio_private_put(dip);
Powered by blists - more mailing lists