* [PATCH 0/4] simple bio cleanups
@ 2026-03-04 19:04 Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
` (4 more replies)
0 siblings, 5 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 19:04 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Gruenbacher, linux-block, drbd-dev, linux-bcache,
dm-devel, linux-f2fs-devel, linux-kernel
Jens,
here are some simple bio related cleanups. Any thoughts? Can those go
in via your tree?
Thanks,
Andreas
Andreas Gruenbacher (4):
block: consecutive blk_status_t error codes
block: get rid of blk_status_to_{errno,str} inconsistency
bio: rename bio_chain arguments
bio: use bio_io_error more often
block/bio.c | 22 +++++++++++-----------
block/blk-core.c | 5 +----
block/fops.c | 3 +--
drivers/block/drbd/drbd_int.h | 3 +--
drivers/md/bcache/bcache.h | 3 +--
drivers/md/bcache/request.c | 6 ++----
drivers/md/dm-mpath.c | 3 +--
drivers/md/dm-writecache.c | 3 +--
fs/f2fs/segment.c | 3 +--
include/linux/blk_types.h | 2 +-
10 files changed, 21 insertions(+), 32 deletions(-)
--
2.52.0
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH 1/4] block: consecutive blk_status_t error codes
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
@ 2026-03-04 19:04 ` Andreas Gruenbacher
2026-03-05 14:12 ` Christoph Hellwig
2026-03-05 22:36 ` John Garry
2026-03-04 19:04 ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
` (3 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 19:04 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Gruenbacher, linux-block, drbd-dev, linux-bcache,
dm-devel, linux-f2fs-devel, linux-kernel
Since commit 9da3d1e912f3 ("block: Add core atomic write support"),
there is a gap in the blk_status_t codes and block status code 18 is
unused. This causes blk_status_to_errno() and blk_status_to_str() to
return incorrect values for that code. Make the blk_status_t codes
consecutive again to avoid that.
Fixes: 9da3d1e912f3 ("block: Add core atomic write support")
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
include/linux/blk_types.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
index 8808ee76e73c..89a722d76c28 100644
--- a/include/linux/blk_types.h
+++ b/include/linux/blk_types.h
@@ -168,7 +168,7 @@ typedef u16 blk_short_t;
/*
* Invalid size or alignment.
*/
-#define BLK_STS_INVAL ((__force blk_status_t)19)
+#define BLK_STS_INVAL ((__force blk_status_t)18)
/**
* blk_path_error - returns true if error may be path related
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
@ 2026-03-04 19:04 ` Andreas Gruenbacher
2026-03-05 14:13 ` Christoph Hellwig
2026-03-06 15:51 ` John Garry
2026-03-04 19:04 ` [PATCH 3/4] bio: rename bio_chain arguments Andreas Gruenbacher
` (2 subsequent siblings)
4 siblings, 2 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 19:04 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Gruenbacher, linux-block, drbd-dev, linux-bcache,
dm-devel, linux-f2fs-devel, linux-kernel
Change blk_status_to_str() to be consistent with blk_status_to_errno()
and return "I/O" for undefined status codes.
With that, the fallback case in the blk_errors array can be removed with
no change in behavior.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
---
block/blk-core.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/block/blk-core.c b/block/blk-core.c
index 474700ffaa1c..a20042f15790 100644
--- a/block/blk-core.c
+++ b/block/blk-core.c
@@ -161,9 +161,6 @@ static const struct {
[BLK_STS_DURATION_LIMIT] = { -ETIME, "duration limit exceeded" },
[BLK_STS_INVAL] = { -EINVAL, "invalid" },
-
- /* everything else not covered above: */
- [BLK_STS_IOERR] = { -EIO, "I/O" },
};
blk_status_t errno_to_blk_status(int errno)
@@ -194,7 +191,7 @@ const char *blk_status_to_str(blk_status_t status)
int idx = (__force int)status;
if (WARN_ON_ONCE(idx >= ARRAY_SIZE(blk_errors)))
- return "<null>";
+ return "I/O";
return blk_errors[idx].name;
}
EXPORT_SYMBOL_GPL(blk_status_to_str);
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 3/4] bio: rename bio_chain arguments
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
@ 2026-03-04 19:04 ` Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
2026-03-13 12:53 ` [PATCH 0/4] simple bio cleanups Shinichiro Kawasaki
4 siblings, 0 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 19:04 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Gruenbacher, linux-block, drbd-dev, linux-bcache,
dm-devel, linux-f2fs-devel, linux-kernel, Christoph Hellwig
Use the same argument names in bio_chain() as in bio_chain_and_submit()
to be consistent. Slightly improve the function description.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/bio.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/block/bio.c b/block/bio.c
index eadf4c1e9994..5e60bf3730af 100644
--- a/block/bio.c
+++ b/block/bio.c
@@ -369,22 +369,22 @@ static void bio_chain_endio(struct bio *bio)
/**
* bio_chain - chain bio completions
- * @bio: the target bio
- * @parent: the parent bio of @bio
+ * @prev: the bio to chain
+ * @new: the bio to chain to
*
- * The caller won't have a bi_end_io called when @bio completes - instead,
- * @parent's bi_end_io won't be called until both @parent and @bio have
- * completed; the chained bio will also be freed when it completes.
+ * The caller won't have a bi_end_io called when @prev completes. Instead,
+ * @new's bi_end_io will be called once both @new and @prev have completed.
+ * Like an unchained bio, @prev will be put when it completes.
*
- * The caller must not set bi_private or bi_end_io in @bio.
+ * The caller must not set bi_private or bi_end_io in @prev.
*/
-void bio_chain(struct bio *bio, struct bio *parent)
+void bio_chain(struct bio *prev, struct bio *new)
{
- BUG_ON(bio->bi_private || bio->bi_end_io);
+ BUG_ON(prev->bi_private || prev->bi_end_io);
- bio->bi_private = parent;
- bio->bi_end_io = bio_chain_endio;
- bio_inc_remaining(parent);
+ prev->bi_private = new;
+ prev->bi_end_io = bio_chain_endio;
+ bio_inc_remaining(new);
}
EXPORT_SYMBOL(bio_chain);
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [PATCH 4/4] bio: use bio_io_error more often
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
` (2 preceding siblings ...)
2026-03-04 19:04 ` [PATCH 3/4] bio: rename bio_chain arguments Andreas Gruenbacher
@ 2026-03-04 19:04 ` Andreas Gruenbacher
2026-03-05 14:14 ` Christoph Hellwig
2026-03-05 14:32 ` Coly Li
2026-03-13 12:53 ` [PATCH 0/4] simple bio cleanups Shinichiro Kawasaki
4 siblings, 2 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-04 19:04 UTC (permalink / raw)
To: Jens Axboe
Cc: Andreas Gruenbacher, linux-block, drbd-dev, linux-bcache,
dm-devel, linux-f2fs-devel, linux-kernel, Christoph Hellwig
Instead of setting bio->bi_status to BLK_STS_IOERR and calling
bio_endio(bio), use the shorthand bio_io_error(bio).
Created with Coccinelle using the following semantic patch:
@@
struct bio *bio;
@@
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
---
block/fops.c | 3 +--
drivers/block/drbd/drbd_int.h | 3 +--
drivers/md/bcache/bcache.h | 3 +--
drivers/md/bcache/request.c | 6 ++----
drivers/md/dm-mpath.c | 3 +--
drivers/md/dm-writecache.c | 3 +--
fs/f2fs/segment.c | 3 +--
7 files changed, 8 insertions(+), 16 deletions(-)
diff --git a/block/fops.c b/block/fops.c
index bb6642b45937..9547f656904d 100644
--- a/block/fops.c
+++ b/block/fops.c
@@ -218,8 +218,7 @@ static ssize_t __blkdev_direct_IO(struct kiocb *iocb, struct iov_iter *iter,
ret = blkdev_iov_iter_get_pages(bio, iter, bdev);
if (unlikely(ret)) {
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
break;
}
if (iocb->ki_flags & IOCB_NOWAIT) {
diff --git a/drivers/block/drbd/drbd_int.h b/drivers/block/drbd/drbd_int.h
index f6d6276974ee..32639e8ea72a 100644
--- a/drivers/block/drbd/drbd_int.h
+++ b/drivers/block/drbd/drbd_int.h
@@ -1491,8 +1491,7 @@ static inline void drbd_submit_bio_noacct(struct drbd_device *device,
__release(local);
if (!bio->bi_bdev) {
drbd_err(device, "drbd_submit_bio_noacct: bio->bi_bdev == NULL\n");
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
return;
}
diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
index ec9ff9715081..e0c9d9eef0a0 100644
--- a/drivers/md/bcache/bcache.h
+++ b/drivers/md/bcache/bcache.h
@@ -947,8 +947,7 @@ static inline void closure_bio_submit(struct cache_set *c,
{
closure_get(cl);
if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) {
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
return;
}
submit_bio_noacct(bio);
diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
index 3fa3b13a410f..0f6fa0a2920b 100644
--- a/drivers/md/bcache/request.c
+++ b/drivers/md/bcache/request.c
@@ -1178,8 +1178,7 @@ void cached_dev_submit_bio(struct bio *bio)
if (unlikely((d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags)) ||
dc->io_disable)) {
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
return;
}
@@ -1283,8 +1282,7 @@ void flash_dev_submit_bio(struct bio *bio)
struct bcache_device *d = bio->bi_bdev->bd_disk->private_data;
if (unlikely(d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags))) {
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
return;
}
diff --git a/drivers/md/dm-mpath.c b/drivers/md/dm-mpath.c
index 7cb7bb6233b6..bf4927f58d7f 100644
--- a/drivers/md/dm-mpath.c
+++ b/drivers/md/dm-mpath.c
@@ -712,8 +712,7 @@ static void process_queued_bios(struct work_struct *work)
r = __multipath_map_bio(m, bio, mpio);
switch (r) {
case DM_MAPIO_KILL:
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
break;
case DM_MAPIO_REQUEUE:
bio->bi_status = BLK_STS_DM_REQUEUE;
diff --git a/drivers/md/dm-writecache.c b/drivers/md/dm-writecache.c
index 98bd945f6da7..78a730a9b1ef 100644
--- a/drivers/md/dm-writecache.c
+++ b/drivers/md/dm-writecache.c
@@ -1876,8 +1876,7 @@ static void __writecache_writeback_pmem(struct dm_writecache *wc, struct writeba
if (WC_MODE_FUA(wc))
bio->bi_opf |= REQ_FUA;
if (writecache_has_error(wc)) {
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
} else if (unlikely(!bio_sectors(bio))) {
bio->bi_status = BLK_STS_OK;
bio_endio(bio);
diff --git a/fs/f2fs/segment.c b/fs/f2fs/segment.c
index 6a97fe76712b..2dac0cbb5540 100644
--- a/fs/f2fs/segment.c
+++ b/fs/f2fs/segment.c
@@ -4101,8 +4101,7 @@ int f2fs_inplace_write_data(struct f2fs_io_info *fio)
if (fio->bio && *(fio->bio)) {
struct bio *bio = *(fio->bio);
- bio->bi_status = BLK_STS_IOERR;
- bio_endio(bio);
+ bio_io_error(bio);
*(fio->bio) = NULL;
}
return err;
--
2.52.0
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] block: consecutive blk_status_t error codes
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
@ 2026-03-05 14:12 ` Christoph Hellwig
2026-03-05 22:36 ` John Garry
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-05 14:12 UTC (permalink / raw)
To: Andreas Gruenbacher
Cc: Jens Axboe, linux-block, drbd-dev, linux-bcache, dm-devel,
linux-f2fs-devel, linux-kernel
On Wed, Mar 04, 2026 at 08:04:06PM +0100, Andreas Gruenbacher wrote:
> Since commit 9da3d1e912f3 ("block: Add core atomic write support"),
> there is a gap in the blk_status_t codes and block status code 18 is
> unused. This causes blk_status_to_errno() and blk_status_to_str() to
> return incorrect values for that code. Make the blk_status_t codes
> consecutive again to avoid that.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency
2026-03-04 19:04 ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
@ 2026-03-05 14:13 ` Christoph Hellwig
2026-03-06 15:51 ` John Garry
1 sibling, 0 replies; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-05 14:13 UTC (permalink / raw)
To: Andreas Gruenbacher
Cc: Jens Axboe, linux-block, drbd-dev, linux-bcache, dm-devel,
linux-f2fs-devel, linux-kernel
On Wed, Mar 04, 2026 at 08:04:07PM +0100, Andreas Gruenbacher wrote:
> Change blk_status_to_str() to be consistent with blk_status_to_errno()
> and return "I/O" for undefined status codes.
>
> With that, the fallback case in the blk_errors array can be removed with
> no change in behavior.
Looks good:
Reviewed-by: Christoph Hellwig <hch@lst.de>
While you're at it: blk_status_to_str is exported, but as no modular
users, can you also drop the export?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] bio: use bio_io_error more often
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
@ 2026-03-05 14:14 ` Christoph Hellwig
2026-03-05 18:37 ` Andreas Gruenbacher
2026-03-05 14:32 ` Coly Li
1 sibling, 1 reply; 14+ messages in thread
From: Christoph Hellwig @ 2026-03-05 14:14 UTC (permalink / raw)
To: Andreas Gruenbacher
Cc: Jens Axboe, linux-block, drbd-dev, linux-bcache, dm-devel,
linux-f2fs-devel, linux-kernel, Christoph Hellwig
On Wed, Mar 04, 2026 at 08:04:09PM +0100, Andreas Gruenbacher wrote:
> Instead of setting bio->bi_status to BLK_STS_IOERR and calling
> bio_endio(bio), use the shorthand bio_io_error(bio).
I'm a little torn how good these helpers actually are, as
hard coding one specific type of error seems to create weird
code and lead to bugs like the xfs one you fixed yesterday.
Maybe we just need a bio_endio_status() that allows passing the
satatus?
Also you really need to send one patch per subsystem.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] bio: use bio_io_error more often
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
2026-03-05 14:14 ` Christoph Hellwig
@ 2026-03-05 14:32 ` Coly Li
1 sibling, 0 replies; 14+ messages in thread
From: Coly Li @ 2026-03-05 14:32 UTC (permalink / raw)
To: Andreas Gruenbacher
Cc: Jens Axboe, linux-block, drbd-dev, linux-bcache, dm-devel,
linux-f2fs-devel, linux-kernel, Christoph Hellwig
On Wed, Mar 04, 2026 at 08:04:09PM +0800, Andreas Gruenbacher wrote:
> Instead of setting bio->bi_status to BLK_STS_IOERR and calling
> bio_endio(bio), use the shorthand bio_io_error(bio).
>
> Created with Coccinelle using the following semantic patch:
>
> @@
> struct bio *bio;
> @@
> - bio->bi_status = BLK_STS_IOERR;
> - bio_endio(bio);
> + bio_io_error(bio);
>
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
> Reviewed-by: Christoph Hellwig <hch@lst.de>
> ---
> block/fops.c | 3 +--
> drivers/block/drbd/drbd_int.h | 3 +--
> drivers/md/bcache/bcache.h | 3 +--
> drivers/md/bcache/request.c | 6 ++----
> drivers/md/dm-mpath.c | 3 +--
> drivers/md/dm-writecache.c | 3 +--
> fs/f2fs/segment.c | 3 +--
> 7 files changed, 8 insertions(+), 16 deletions(-)
>
[snipped]
>
> diff --git a/drivers/md/bcache/bcache.h b/drivers/md/bcache/bcache.h
> index ec9ff9715081..e0c9d9eef0a0 100644
> --- a/drivers/md/bcache/bcache.h
> +++ b/drivers/md/bcache/bcache.h
> @@ -947,8 +947,7 @@ static inline void closure_bio_submit(struct cache_set *c,
> {
> closure_get(cl);
> if (unlikely(test_bit(CACHE_SET_IO_DISABLE, &c->flags))) {
> - bio->bi_status = BLK_STS_IOERR;
> - bio_endio(bio);
> + bio_io_error(bio);
> return;
> }
> submit_bio_noacct(bio);
> diff --git a/drivers/md/bcache/request.c b/drivers/md/bcache/request.c
> index 3fa3b13a410f..0f6fa0a2920b 100644
> --- a/drivers/md/bcache/request.c
> +++ b/drivers/md/bcache/request.c
> @@ -1178,8 +1178,7 @@ void cached_dev_submit_bio(struct bio *bio)
>
> if (unlikely((d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags)) ||
> dc->io_disable)) {
> - bio->bi_status = BLK_STS_IOERR;
> - bio_endio(bio);
> + bio_io_error(bio);
> return;
> }
>
> @@ -1283,8 +1282,7 @@ void flash_dev_submit_bio(struct bio *bio)
> struct bcache_device *d = bio->bi_bdev->bd_disk->private_data;
>
> if (unlikely(d->c && test_bit(CACHE_SET_IO_DISABLE, &d->c->flags))) {
> - bio->bi_status = BLK_STS_IOERR;
> - bio_endio(bio);
> + bio_io_error(bio);
> return;
> }
>
For bcache part, I feel current hard code is explict and clear.
The bio_io_error() wrapper is not so directly understood. This is just
my opinion, not a strong objection.
Thanks.
Coly Li
[snipped]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 4/4] bio: use bio_io_error more often
2026-03-05 14:14 ` Christoph Hellwig
@ 2026-03-05 18:37 ` Andreas Gruenbacher
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-05 18:37 UTC (permalink / raw)
To: Christoph Hellwig
Cc: Jens Axboe, linux-block, drbd-dev, linux-bcache, dm-devel,
linux-f2fs-devel, linux-kernel, Christoph Hellwig
On Thu, Mar 5, 2026 at 3:14 PM Christoph Hellwig <hch@infradead.org> wrote:
> On Wed, Mar 04, 2026 at 08:04:09PM +0100, Andreas Gruenbacher wrote:
> > Instead of setting bio->bi_status to BLK_STS_IOERR and calling
> > bio_endio(bio), use the shorthand bio_io_error(bio).
>
> I'm a little torn how good these helpers actually are, as
> hard coding one specific type of error seems to create weird
> code and lead to bugs like the xfs one you fixed yesterday.
>
> Maybe we just need a bio_endio_status() that allows passing the
> status?
I'm not particularly attached to bio_io_error(bio); it's been around
forever but it can be confusing. Any thoughts on replacing it with a
new bio_endio_status(bio, BLK_STS_IOERR) helper instead of keeping two
mechanisms for doing the same thing?
> Also you really need to send one patch per subsystem.
I'm really trying to avoid that for simple, obviously correct,
mechanical changes that can be recreated from scratch any time.
Thanks,
Andreas
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 1/4] block: consecutive blk_status_t error codes
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
2026-03-05 14:12 ` Christoph Hellwig
@ 2026-03-05 22:36 ` John Garry
1 sibling, 0 replies; 14+ messages in thread
From: John Garry @ 2026-03-05 22:36 UTC (permalink / raw)
To: Andreas Gruenbacher, Jens Axboe
Cc: linux-block, drbd-dev, linux-bcache, dm-devel, linux-f2fs-devel,
linux-kernel
On 04/03/2026 19:04, Andreas Gruenbacher wrote:
> Since commit 9da3d1e912f3 ("block: Add core atomic write support"),
> there is a gap in the blk_status_t codes and block status code 18 is
> unused. This causes blk_status_to_errno() and blk_status_to_str() to
> return incorrect values for that code.
Sure, we get the wrong value (for 18), but 18 does not match a valid
blk_status_t
> Make the blk_status_t codes
> consecutive again to avoid that.
>
> Fixes: 9da3d1e912f3 ("block: Add core atomic write support")
> Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
> ---
> include/linux/blk_types.h | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/include/linux/blk_types.h b/include/linux/blk_types.h
> index 8808ee76e73c..89a722d76c28 100644
> --- a/include/linux/blk_types.h
> +++ b/include/linux/blk_types.h
> @@ -168,7 +168,7 @@ typedef u16 blk_short_t;
> /*
> * Invalid size or alignment.
> */
> -#define BLK_STS_INVAL ((__force blk_status_t)19)
> +#define BLK_STS_INVAL ((__force blk_status_t)18)
>
> /**
> * blk_path_error - returns true if error may be path related
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency
2026-03-04 19:04 ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
2026-03-05 14:13 ` Christoph Hellwig
@ 2026-03-06 15:51 ` John Garry
1 sibling, 0 replies; 14+ messages in thread
From: John Garry @ 2026-03-06 15:51 UTC (permalink / raw)
To: Andreas Gruenbacher, Jens Axboe
Cc: linux-block, drbd-dev, linux-bcache, dm-devel, linux-f2fs-devel,
linux-kernel
On 04/03/2026 19:04, Andreas Gruenbacher wrote:
> Change blk_status_to_str() to be consistent with blk_status_to_errno()
> and return "I/O" for undefined status codes.
>
> With that, the fallback case in the blk_errors array can be removed with
> no change in behavior.
>
> Signed-off-by: Andreas Gruenbacher<agruenba@redhat.com>
Reviewed-by: John Garry <john.g.garry@oracle.com>
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/4] simple bio cleanups
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
` (3 preceding siblings ...)
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
@ 2026-03-13 12:53 ` Shinichiro Kawasaki
2026-03-13 14:35 ` Andreas Gruenbacher
4 siblings, 1 reply; 14+ messages in thread
From: Shinichiro Kawasaki @ 2026-03-13 12:53 UTC (permalink / raw)
To: Andreas Gruenbacher
Cc: Jens Axboe, linux-block@vger.kernel.org,
drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org,
dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
On Mar 04, 2026 / 20:04, Andreas Gruenbacher wrote:
> Jens,
>
> here are some simple bio related cleanups. Any thoughts? Can those go
> in via your tree?
>
> Thanks,
> Andreas
>
> Andreas Gruenbacher (4):
> block: consecutive blk_status_t error codes
> block: get rid of blk_status_to_{errno,str} inconsistency
> bio: rename bio_chain arguments
> bio: use bio_io_error more often
Hello Andreas, during blktests CI trial runs, I noticed that this patch series
triggered failures of three blktests test cases: scsi/004, scsi/007 and
throtl/004. Do you see which patch triggered these failures?
scsi/004 (ensure repeated TASK SET FULL results in EIO on timing out command) [failed]
runtime ... 3.855s
--- tests/scsi/004.out 2026-03-12 15:23:54.664435639 +0000
+++ /home/fedora/blktests/results/nodev/scsi/004.out.bad 2026-03-12 18:13:40.059747989 +0000
@@ -1,3 +1,2 @@
Running scsi/004
-Input/output error
Test complete
scsi/007 (Trigger the SCSI error handler) [failed]
runtime ... 115.385s
--- tests/scsi/007.out 2026-03-12 15:23:54.668435644 +0000
+++ /home/fedora/blktests/results/nodev/scsi/007.out.bad 2026-03-12 18:15:55.054944537 +0000
@@ -1,3 +1,3 @@
Running scsi/007
-Reading from scsi_debug failed
+Reading from scsi_debug succeeded
Test complete
throtl/004 (nullb) (delete disk while IO is throttled) [failed]
runtime ... 1.643s
--- tests/throtl/004.out 2026-03-12 15:23:54.710435695 +0000
+++ /home/fedora/blktests/results/nodev_nullb/throtl/004.out.bad 2026-03-12 18:20:46.314368581 +0000
@@ -1,3 +1,2 @@
Running throtl/004
-Input/output error
Test complete
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH 0/4] simple bio cleanups
2026-03-13 12:53 ` [PATCH 0/4] simple bio cleanups Shinichiro Kawasaki
@ 2026-03-13 14:35 ` Andreas Gruenbacher
0 siblings, 0 replies; 14+ messages in thread
From: Andreas Gruenbacher @ 2026-03-13 14:35 UTC (permalink / raw)
To: Shinichiro Kawasaki
Cc: Jens Axboe, linux-block@vger.kernel.org,
drbd-dev@lists.linbit.com, linux-bcache@vger.kernel.org,
dm-devel@lists.linux.dev, linux-f2fs-devel@lists.sourceforge.net,
linux-kernel@vger.kernel.org
On Fri, Mar 13, 2026 at 1:54 PM Shinichiro Kawasaki
<shinichiro.kawasaki@wdc.com> wrote:
> On Mar 04, 2026 / 20:04, Andreas Gruenbacher wrote:
> > Jens,
> >
> > here are some simple bio related cleanups. Any thoughts? Can those go
> > in via your tree?
> >
> > Thanks,
> > Andreas
> >
> > Andreas Gruenbacher (4):
> > block: consecutive blk_status_t error codes
> > block: get rid of blk_status_to_{errno,str} inconsistency
> > bio: rename bio_chain arguments
> > bio: use bio_io_error more often
>
> Hello Andreas, during blktests CI trial runs, I noticed that this patch series
> triggered failures of three blktests test cases: scsi/004, scsi/007 and
> throtl/004. Do you see which patch triggered these failures?
Hello Shinichiro,
thanks a lot for the report. I now see that patch "block: get rid of
blk_status_to_{errno,str} inconsistency" is broken in its current
form.
Andreas
>
>
> scsi/004 (ensure repeated TASK SET FULL results in EIO on timing out command) [failed]
> runtime ... 3.855s
> --- tests/scsi/004.out 2026-03-12 15:23:54.664435639 +0000
> +++ /home/fedora/blktests/results/nodev/scsi/004.out.bad 2026-03-12 18:13:40.059747989 +0000
> @@ -1,3 +1,2 @@
> Running scsi/004
> -Input/output error
> Test complete
>
> scsi/007 (Trigger the SCSI error handler) [failed]
> runtime ... 115.385s
> --- tests/scsi/007.out 2026-03-12 15:23:54.668435644 +0000
> +++ /home/fedora/blktests/results/nodev/scsi/007.out.bad 2026-03-12 18:15:55.054944537 +0000
> @@ -1,3 +1,3 @@
> Running scsi/007
> -Reading from scsi_debug failed
> +Reading from scsi_debug succeeded
> Test complete
>
> throtl/004 (nullb) (delete disk while IO is throttled) [failed]
> runtime ... 1.643s
> --- tests/throtl/004.out 2026-03-12 15:23:54.710435695 +0000
> +++ /home/fedora/blktests/results/nodev_nullb/throtl/004.out.bad 2026-03-12 18:20:46.314368581 +0000
> @@ -1,3 +1,2 @@
> Running throtl/004
> -Input/output error
> Test complete
>
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2026-03-13 14:36 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-04 19:04 [PATCH 0/4] simple bio cleanups Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 1/4] block: consecutive blk_status_t error codes Andreas Gruenbacher
2026-03-05 14:12 ` Christoph Hellwig
2026-03-05 22:36 ` John Garry
2026-03-04 19:04 ` [PATCH 2/4] block: get rid of blk_status_to_{errno,str} inconsistency Andreas Gruenbacher
2026-03-05 14:13 ` Christoph Hellwig
2026-03-06 15:51 ` John Garry
2026-03-04 19:04 ` [PATCH 3/4] bio: rename bio_chain arguments Andreas Gruenbacher
2026-03-04 19:04 ` [PATCH 4/4] bio: use bio_io_error more often Andreas Gruenbacher
2026-03-05 14:14 ` Christoph Hellwig
2026-03-05 18:37 ` Andreas Gruenbacher
2026-03-05 14:32 ` Coly Li
2026-03-13 12:53 ` [PATCH 0/4] simple bio cleanups Shinichiro Kawasaki
2026-03-13 14:35 ` Andreas Gruenbacher
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox