* [PATCH] btrfs: fix unnecessary increment of read error stat on write error
@ 2023-02-13 5:10 Naohiro Aota
2023-02-13 6:42 ` Christoph Hellwig
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Naohiro Aota @ 2023-02-13 5:10 UTC (permalink / raw)
To: linux-btrfs; +Cc: Naohiro Aota, stable
Current btrfs_log_dev_io_error() increases the read error count even if the
erroneous IO is a WRITE request. This is because it forget to use "else
if", and all the error WRITE requests counts as READ error as there is (of
course) no REQ_RAHEAD bit set.
Fixes: c3a62baf21ad ("btrfs: use chained bios when cloning")
CC: stable@vger.kernel.org # 6.1
Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
---
fs/btrfs/bio.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/btrfs/bio.c b/fs/btrfs/bio.c
index d8b90f95b157..726592868e9c 100644
--- a/fs/btrfs/bio.c
+++ b/fs/btrfs/bio.c
@@ -287,7 +287,7 @@ static void btrfs_log_dev_io_error(struct bio *bio, struct btrfs_device *dev)
if (btrfs_op(bio) == BTRFS_MAP_WRITE)
btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_WRITE_ERRS);
- if (!(bio->bi_opf & REQ_RAHEAD))
+ else if (!(bio->bi_opf & REQ_RAHEAD))
btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_READ_ERRS);
if (bio->bi_opf & REQ_PREFLUSH)
btrfs_dev_stat_inc_and_print(dev, BTRFS_DEV_STAT_FLUSH_ERRS);
--
2.39.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: fix unnecessary increment of read error stat on write error
2023-02-13 5:10 [PATCH] btrfs: fix unnecessary increment of read error stat on write error Naohiro Aota
@ 2023-02-13 6:42 ` Christoph Hellwig
2023-02-13 7:55 ` Johannes Thumshirn
2023-02-20 20:04 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Christoph Hellwig @ 2023-02-13 6:42 UTC (permalink / raw)
To: Naohiro Aota; +Cc: linux-btrfs, stable
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: fix unnecessary increment of read error stat on write error
2023-02-13 5:10 [PATCH] btrfs: fix unnecessary increment of read error stat on write error Naohiro Aota
2023-02-13 6:42 ` Christoph Hellwig
@ 2023-02-13 7:55 ` Johannes Thumshirn
2023-02-20 20:04 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: Johannes Thumshirn @ 2023-02-13 7:55 UTC (permalink / raw)
To: Naohiro Aota, linux-btrfs@vger.kernel.org; +Cc: stable@vger.kernel.org
Looks good,
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] btrfs: fix unnecessary increment of read error stat on write error
2023-02-13 5:10 [PATCH] btrfs: fix unnecessary increment of read error stat on write error Naohiro Aota
2023-02-13 6:42 ` Christoph Hellwig
2023-02-13 7:55 ` Johannes Thumshirn
@ 2023-02-20 20:04 ` David Sterba
2 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2023-02-20 20:04 UTC (permalink / raw)
To: Naohiro Aota; +Cc: linux-btrfs, stable
On Mon, Feb 13, 2023 at 02:10:38PM +0900, Naohiro Aota wrote:
> Current btrfs_log_dev_io_error() increases the read error count even if the
> erroneous IO is a WRITE request. This is because it forget to use "else
> if", and all the error WRITE requests counts as READ error as there is (of
> course) no REQ_RAHEAD bit set.
>
> Fixes: c3a62baf21ad ("btrfs: use chained bios when cloning")
> CC: stable@vger.kernel.org # 6.1
> Signed-off-by: Naohiro Aota <naohiro.aota@wdc.com>
Added to misc-next, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-02-20 20:10 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-02-13 5:10 [PATCH] btrfs: fix unnecessary increment of read error stat on write error Naohiro Aota
2023-02-13 6:42 ` Christoph Hellwig
2023-02-13 7:55 ` Johannes Thumshirn
2023-02-20 20:04 ` David Sterba
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox