mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-06 22:42:10 +00:00
block: handle bio_split_to_limits() NULL return
This can't happen right now, but in preparation for allowing bio_split_to_limits() returning NULL if it ended the bio, check for it in all the callers. Signed-off-by: Jens Axboe <axboe@kernel.dk>
This commit is contained in:
parent
1551ed5a17
commit
613b14884b
8 changed files with 19 additions and 2 deletions
|
@ -358,11 +358,13 @@ struct bio *__bio_split_to_limits(struct bio *bio,
|
||||||
default:
|
default:
|
||||||
split = bio_split_rw(bio, lim, nr_segs, bs,
|
split = bio_split_rw(bio, lim, nr_segs, bs,
|
||||||
get_max_io_size(bio, lim) << SECTOR_SHIFT);
|
get_max_io_size(bio, lim) << SECTOR_SHIFT);
|
||||||
|
if (IS_ERR(split))
|
||||||
|
return NULL;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (split) {
|
if (split) {
|
||||||
/* there isn't chance to merge the splitted bio */
|
/* there isn't chance to merge the split bio */
|
||||||
split->bi_opf |= REQ_NOMERGE;
|
split->bi_opf |= REQ_NOMERGE;
|
||||||
|
|
||||||
blkcg_bio_issue_init(split);
|
blkcg_bio_issue_init(split);
|
||||||
|
|
|
@ -2951,8 +2951,11 @@ void blk_mq_submit_bio(struct bio *bio)
|
||||||
blk_status_t ret;
|
blk_status_t ret;
|
||||||
|
|
||||||
bio = blk_queue_bounce(bio, q);
|
bio = blk_queue_bounce(bio, q);
|
||||||
if (bio_may_exceed_limits(bio, &q->limits))
|
if (bio_may_exceed_limits(bio, &q->limits)) {
|
||||||
bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);
|
bio = __bio_split_to_limits(bio, &q->limits, &nr_segs);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!bio_integrity_prep(bio))
|
if (!bio_integrity_prep(bio))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1607,6 +1607,8 @@ void drbd_submit_bio(struct bio *bio)
|
||||||
struct drbd_device *device = bio->bi_bdev->bd_disk->private_data;
|
struct drbd_device *device = bio->bi_bdev->bd_disk->private_data;
|
||||||
|
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* what we "blindly" assume:
|
* what we "blindly" assume:
|
||||||
|
|
|
@ -587,6 +587,8 @@ static void ps3vram_submit_bio(struct bio *bio)
|
||||||
dev_dbg(&dev->core, "%s\n", __func__);
|
dev_dbg(&dev->core, "%s\n", __func__);
|
||||||
|
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
|
||||||
spin_lock_irq(&priv->lock);
|
spin_lock_irq(&priv->lock);
|
||||||
busy = !bio_list_empty(&priv->list);
|
busy = !bio_list_empty(&priv->list);
|
||||||
|
|
|
@ -1742,6 +1742,8 @@ static void dm_split_and_process_bio(struct mapped_device *md,
|
||||||
* otherwise associated queue_limits won't be imposed.
|
* otherwise associated queue_limits won't be imposed.
|
||||||
*/
|
*/
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
init_clone_info(&ci, md, map, bio, is_abnormal);
|
init_clone_info(&ci, md, map, bio, is_abnormal);
|
||||||
|
|
|
@ -455,6 +455,8 @@ static void md_submit_bio(struct bio *bio)
|
||||||
}
|
}
|
||||||
|
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
|
||||||
if (mddev->ro == MD_RDONLY && unlikely(rw == WRITE)) {
|
if (mddev->ro == MD_RDONLY && unlikely(rw == WRITE)) {
|
||||||
if (bio_sectors(bio) != 0)
|
if (bio_sectors(bio) != 0)
|
||||||
|
|
|
@ -376,6 +376,8 @@ static void nvme_ns_head_submit_bio(struct bio *bio)
|
||||||
* pool from the original queue to allocate the bvecs from.
|
* pool from the original queue to allocate the bvecs from.
|
||||||
*/
|
*/
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
|
||||||
srcu_idx = srcu_read_lock(&head->srcu);
|
srcu_idx = srcu_read_lock(&head->srcu);
|
||||||
ns = nvme_find_path(head);
|
ns = nvme_find_path(head);
|
||||||
|
|
|
@ -865,6 +865,8 @@ dcssblk_submit_bio(struct bio *bio)
|
||||||
unsigned long bytes_done;
|
unsigned long bytes_done;
|
||||||
|
|
||||||
bio = bio_split_to_limits(bio);
|
bio = bio_split_to_limits(bio);
|
||||||
|
if (!bio)
|
||||||
|
return;
|
||||||
|
|
||||||
bytes_done = 0;
|
bytes_done = 0;
|
||||||
dev_info = bio->bi_bdev->bd_disk->private_data;
|
dev_info = bio->bi_bdev->bd_disk->private_data;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue