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@redhat.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