Commit 51d74ec9 authored by Jinyoung Choi's avatar Jinyoung Choi Committed by Jens Axboe

block: cleanup bio_integrity_prep

If a problem occurs in the process of creating an integrity payload, the
status of bio is always BLK_STS_RESOURCE.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarJinyoung Choi <j-young.choi@samsung.com>
Reviewed-by: default avatar"Martin K. Petersen" <martin.petersen@oracle.com>
Link: https://lore.kernel.org/r/20230725051839epcms2p8e4d20ad6c51326ad032e8406f59d0aaa@epcms2p8Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent 65a558f6
...@@ -199,7 +199,6 @@ bool bio_integrity_prep(struct bio *bio) ...@@ -199,7 +199,6 @@ bool bio_integrity_prep(struct bio *bio)
unsigned long start, end; unsigned long start, end;
unsigned int len, nr_pages; unsigned int len, nr_pages;
unsigned int bytes, offset, i; unsigned int bytes, offset, i;
blk_status_t status;
if (!bi) if (!bi)
return true; return true;
...@@ -227,7 +226,6 @@ bool bio_integrity_prep(struct bio *bio) ...@@ -227,7 +226,6 @@ bool bio_integrity_prep(struct bio *bio)
/* Allocate kernel buffer for protection data */ /* Allocate kernel buffer for protection data */
len = bio_integrity_bytes(bi, bio_sectors(bio)); len = bio_integrity_bytes(bi, bio_sectors(bio));
buf = kmalloc(len, GFP_NOIO); buf = kmalloc(len, GFP_NOIO);
status = BLK_STS_RESOURCE;
if (unlikely(buf == NULL)) { if (unlikely(buf == NULL)) {
printk(KERN_ERR "could not allocate integrity buffer\n"); printk(KERN_ERR "could not allocate integrity buffer\n");
goto err_end_io; goto err_end_io;
...@@ -242,7 +240,6 @@ bool bio_integrity_prep(struct bio *bio) ...@@ -242,7 +240,6 @@ bool bio_integrity_prep(struct bio *bio)
if (IS_ERR(bip)) { if (IS_ERR(bip)) {
printk(KERN_ERR "could not allocate data integrity bioset\n"); printk(KERN_ERR "could not allocate data integrity bioset\n");
kfree(buf); kfree(buf);
status = BLK_STS_RESOURCE;
goto err_end_io; goto err_end_io;
} }
...@@ -270,7 +267,6 @@ bool bio_integrity_prep(struct bio *bio) ...@@ -270,7 +267,6 @@ bool bio_integrity_prep(struct bio *bio)
if (ret == 0) { if (ret == 0) {
printk(KERN_ERR "could not attach integrity payload\n"); printk(KERN_ERR "could not attach integrity payload\n");
status = BLK_STS_RESOURCE;
goto err_end_io; goto err_end_io;
} }
...@@ -292,7 +288,7 @@ bool bio_integrity_prep(struct bio *bio) ...@@ -292,7 +288,7 @@ bool bio_integrity_prep(struct bio *bio)
return true; return true;
err_end_io: err_end_io:
bio->bi_status = status; bio->bi_status = BLK_STS_RESOURCE;
bio_endio(bio); bio_endio(bio);
return false; return false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment