[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251221025233.87087-17-agruenba@redhat.com>
Date: Sun, 21 Dec 2025 03:52:31 +0100
From: Andreas Gruenbacher <agruenba@...hat.com>
To: Christoph Hellwig <hch@...radead.org>,
Jens Axboe <axboe@...nel.dk>,
Chris Mason <clm@...com>,
David Sterba <dsterba@...e.com>,
Satya Tangirala <satyat@...gle.com>
Cc: Andreas Gruenbacher <agruenba@...hat.com>,
linux-block@...r.kernel.org,
linux-btrfs@...r.kernel.org,
linux-raid@...r.kernel.org,
dm-devel@...ts.linux.dev,
linux-kernel@...r.kernel.org
Subject: [RFC v2 16/17] bio: never set bi_status to BLK_STS_OK during completion (part 2)
In these two places, it seems that errno can be 0. This would assign
BLK_STS_OK (0) to bio->bi_status, which is not allowed. Fix that by
using bio_set_status() instead.
Created with Coccinelle using the following semantic patch.
(Coccinelle occasionally likes to add unnecessary curly braces
in if statements; those were removed by hand.)
@@
struct bio *bio;
expression errno;
@@
- bio->bi_status = errno_to_blk_status(errno);
+ bio_set_status(bio, errno_to_blk_status(errno));
@@
struct bio bio;
expression errno;
@@
- bio.bi_status = errno_to_blk_status(errno);
+ bio_set_status(&bio, errno_to_blk_status(errno));
Signed-off-by: Andreas Gruenbacher <agruenba@...hat.com>
---
drivers/md/dm-pcache/dm_pcache.c | 2 +-
drivers/md/dm-vdo/data-vio.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/md/dm-pcache/dm_pcache.c b/drivers/md/dm-pcache/dm_pcache.c
index e5f5936fa6f0..086ae9b06bfb 100644
--- a/drivers/md/dm-pcache/dm_pcache.c
+++ b/drivers/md/dm-pcache/dm_pcache.c
@@ -74,7 +74,7 @@ static void end_req(struct kref *ref)
pcache_req_get(pcache_req);
defer_req(pcache_req);
} else {
- bio->bi_status = errno_to_blk_status(ret);
+ bio_set_status(bio, errno_to_blk_status(ret));
bio_endio(bio);
if (atomic_dec_and_test(&pcache->inflight_reqs))
diff --git a/drivers/md/dm-vdo/data-vio.c b/drivers/md/dm-vdo/data-vio.c
index 262e11581f2d..11becc4138c4 100644
--- a/drivers/md/dm-vdo/data-vio.c
+++ b/drivers/md/dm-vdo/data-vio.c
@@ -287,7 +287,7 @@ static void acknowledge_data_vio(struct data_vio *data_vio)
if (data_vio->is_partial)
vdo_count_bios(&vdo->stats.bios_acknowledged_partial, bio);
- bio->bi_status = errno_to_blk_status(error);
+ bio_set_status(bio, errno_to_blk_status(error));
bio_endio(bio);
}
--
2.52.0
Powered by blists - more mailing lists