From: Andreas Gruenbacher <agruenba@redhat.com>
To: Christoph Hellwig <hch@infradead.org>,
Jens Axboe <axboe@kernel.dk>, Chris Mason <clm@fb.com>,
David Sterba <dsterba@suse.com>,
Satya Tangirala <satyat@google.com>
Cc: Andreas Gruenbacher <agruenba@redhat.com>,
linux-block@vger.kernel.org, linux-btrfs@vger.kernel.org,
linux-raid@vger.kernel.org, dm-devel@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: [RFC v2 15/17] bio: never set bi_status to BLK_STS_OK during completion
Date: Sun, 21 Dec 2025 03:52:30 +0100 [thread overview]
Message-ID: <20251221025233.87087-16-agruenba@redhat.com> (raw)
In-Reply-To: <20251221025233.87087-1-agruenba@redhat.com>
In a few places in the code, we don't know if a bio has failed or
completed successfully, so use bio_set_status() instead of setting
bi_status directly. That way, bi_status will never be set to
BI_STS_OK (0) during completion.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
block/blk-crypto-fallback.c | 2 +-
drivers/block/ps3vram.c | 2 +-
drivers/md/dm-flakey.c | 2 +-
drivers/md/dm-verity-target.c | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/block/blk-crypto-fallback.c b/block/blk-crypto-fallback.c
index 8a2631b1e7e1..7014f646e236 100644
--- a/block/blk-crypto-fallback.c
+++ b/block/blk-crypto-fallback.c
@@ -150,7 +150,7 @@ static void blk_crypto_fallback_encrypt_endio(struct bio *enc_bio)
mempool_free(enc_bio->bi_io_vec[i].bv_page,
blk_crypto_bounce_page_pool);
- src_bio->bi_status = enc_bio->bi_status;
+ bio_set_status(src_bio, enc_bio->bi_status);
bio_uninit(enc_bio);
kfree(enc_bio);
diff --git a/drivers/block/ps3vram.c b/drivers/block/ps3vram.c
index bdcf083b45e2..06844674c998 100644
--- a/drivers/block/ps3vram.c
+++ b/drivers/block/ps3vram.c
@@ -573,7 +573,7 @@ static struct bio *ps3vram_do_bio(struct ps3_system_bus_device *dev,
next = bio_list_peek(&priv->list);
spin_unlock_irq(&priv->lock);
- bio->bi_status = error;
+ bio_set_status(bio, error);
bio_endio(bio);
return next;
}
diff --git a/drivers/md/dm-flakey.c b/drivers/md/dm-flakey.c
index 08925aca838c..8dde47beb387 100644
--- a/drivers/md/dm-flakey.c
+++ b/drivers/md/dm-flakey.c
@@ -420,7 +420,7 @@ static void clone_free(struct bio *clone)
static void clone_endio(struct bio *clone)
{
struct bio *bio = clone->bi_private;
- bio->bi_status = clone->bi_status;
+ bio_set_status(bio, clone->bi_status);
clone_free(clone);
bio_endio(bio);
}
diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c
index 66a00a8ccb39..4793bcf546ad 100644
--- a/drivers/md/dm-verity-target.c
+++ b/drivers/md/dm-verity-target.c
@@ -544,7 +544,7 @@ static void verity_finish_io(struct dm_verity_io *io, blk_status_t status)
struct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);
bio->bi_end_io = io->orig_bi_end_io;
- bio->bi_status = status;
+ bio_set_status(bio, status);
if (!static_branch_unlikely(&use_bh_wq_enabled) || !io->in_bh)
verity_fec_finish_io(io);
--
2.52.0
next prev parent reply other threads:[~2025-12-21 2:53 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-21 2:52 [RFC v2 00/17] bio cleanups Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 01/17] xfs: don't clobber bi_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
2025-12-21 15:39 ` Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 02/17] bio: rename bio_chain arguments Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 03/17] bio: use bio_io_error more often Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 04/17] bio: add bio_set_status Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 05/17] bio: use bio_set_status for BLK_STS_* status codes Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 06/17] bio: do not check bio->bi_status before assigning to it Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 07/17] block: consecutive blk_status_t error codes Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 08/17] block: fix blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 09/17] block: turn blk_errors array into a macro Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 10/17] block: optimize blk_status <=> errno conversion Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 11/17] bio: bio_set_status from non-zero errno Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 12/17] bio: do not check bio->bi_status before assigning to it (part 2) Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 13/17] xfs: use bio_set_status in xfs_zone_alloc_and_submit Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 14/17] bio: switch to bio_set_status in submit_bio_noacct Andreas Gruenbacher
2025-12-21 2:52 ` Andreas Gruenbacher [this message]
2025-12-21 2:52 ` [RFC v2 16/17] bio: never set bi_status to BLK_STS_OK during completion (part 2) Andreas Gruenbacher
2025-12-21 2:52 ` [RFC v2 17/17] bio: add bio_endio_status Andreas Gruenbacher
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251221025233.87087-16-agruenba@redhat.com \
--to=agruenba@redhat.com \
--cc=axboe@kernel.dk \
--cc=clm@fb.com \
--cc=dm-devel@lists.linux.dev \
--cc=dsterba@suse.com \
--cc=hch@infradead.org \
--cc=linux-block@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-raid@vger.kernel.org \
--cc=satyat@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®