diff options
-rw-r--r-- | block/blk-core.c | 4 | ||||
-rw-r--r-- | drivers/block/null_blk.c | 6 | ||||
-rw-r--r-- | drivers/nvme/host/pci.c | 20 |
3 files changed, 24 insertions, 6 deletions
diff --git a/block/blk-core.c b/block/blk-core.c index 3636be469fa2..c487b94c59e3 100644 --- a/block/blk-core.c +++ b/block/blk-core.c | |||
@@ -1689,8 +1689,6 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) | |||
1689 | struct request *req; | 1689 | struct request *req; |
1690 | unsigned int request_count = 0; | 1690 | unsigned int request_count = 0; |
1691 | 1691 | ||
1692 | blk_queue_split(q, &bio, q->bio_split); | ||
1693 | |||
1694 | /* | 1692 | /* |
1695 | * low level driver can indicate that it wants pages above a | 1693 | * low level driver can indicate that it wants pages above a |
1696 | * certain limit bounced to low memory (ie for highmem, or even | 1694 | * certain limit bounced to low memory (ie for highmem, or even |
@@ -1698,6 +1696,8 @@ static blk_qc_t blk_queue_bio(struct request_queue *q, struct bio *bio) | |||
1698 | */ | 1696 | */ |
1699 | blk_queue_bounce(q, &bio); | 1697 | blk_queue_bounce(q, &bio); |
1700 | 1698 | ||
1699 | blk_queue_split(q, &bio, q->bio_split); | ||
1700 | |||
1701 | if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { | 1701 | if (bio_integrity_enabled(bio) && bio_integrity_prep(bio)) { |
1702 | bio->bi_error = -EIO; | 1702 | bio->bi_error = -EIO; |
1703 | bio_endio(bio); | 1703 | bio_endio(bio); |
diff --git a/drivers/block/null_blk.c b/drivers/block/null_blk.c index 8162475d96b5..a428e4ef71fd 100644 --- a/drivers/block/null_blk.c +++ b/drivers/block/null_blk.c | |||
@@ -219,6 +219,9 @@ static void end_cmd(struct nullb_cmd *cmd) | |||
219 | { | 219 | { |
220 | struct request_queue *q = NULL; | 220 | struct request_queue *q = NULL; |
221 | 221 | ||
222 | if (cmd->rq) | ||
223 | q = cmd->rq->q; | ||
224 | |||
222 | switch (queue_mode) { | 225 | switch (queue_mode) { |
223 | case NULL_Q_MQ: | 226 | case NULL_Q_MQ: |
224 | blk_mq_end_request(cmd->rq, 0); | 227 | blk_mq_end_request(cmd->rq, 0); |
@@ -232,9 +235,6 @@ static void end_cmd(struct nullb_cmd *cmd) | |||
232 | goto free_cmd; | 235 | goto free_cmd; |
233 | } | 236 | } |
234 | 237 | ||
235 | if (cmd->rq) | ||
236 | q = cmd->rq->q; | ||
237 | |||
238 | /* Restart queue if needed, as we are freeing a tag */ | 238 | /* Restart queue if needed, as we are freeing a tag */ |
239 | if (q && !q->mq_ops && blk_queue_stopped(q)) { | 239 | if (q && !q->mq_ops && blk_queue_stopped(q)) { |
240 | unsigned long flags; | 240 | unsigned long flags; |
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c index 9e294ff4e652..0c67b57be83c 100644 --- a/drivers/nvme/host/pci.c +++ b/drivers/nvme/host/pci.c | |||
@@ -2540,8 +2540,17 @@ static void nvme_ns_remove(struct nvme_ns *ns) | |||
2540 | { | 2540 | { |
2541 | bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue); | 2541 | bool kill = nvme_io_incapable(ns->dev) && !blk_queue_dying(ns->queue); |
2542 | 2542 | ||
2543 | if (kill) | 2543 | if (kill) { |
2544 | blk_set_queue_dying(ns->queue); | 2544 | blk_set_queue_dying(ns->queue); |
2545 | |||
2546 | /* | ||
2547 | * The controller was shutdown first if we got here through | ||
2548 | * device removal. The shutdown may requeue outstanding | ||
2549 | * requests. These need to be aborted immediately so | ||
2550 | * del_gendisk doesn't block indefinitely for their completion. | ||
2551 | */ | ||
2552 | blk_mq_abort_requeue_list(ns->queue); | ||
2553 | } | ||
2545 | if (ns->disk->flags & GENHD_FL_UP) | 2554 | if (ns->disk->flags & GENHD_FL_UP) |
2546 | del_gendisk(ns->disk); | 2555 | del_gendisk(ns->disk); |
2547 | if (kill || !blk_queue_dying(ns->queue)) { | 2556 | if (kill || !blk_queue_dying(ns->queue)) { |
@@ -2977,6 +2986,15 @@ static void nvme_dev_remove(struct nvme_dev *dev) | |||
2977 | { | 2986 | { |
2978 | struct nvme_ns *ns, *next; | 2987 | struct nvme_ns *ns, *next; |
2979 | 2988 | ||
2989 | if (nvme_io_incapable(dev)) { | ||
2990 | /* | ||
2991 | * If the device is not capable of IO (surprise hot-removal, | ||
2992 | * for example), we need to quiesce prior to deleting the | ||
2993 | * namespaces. This will end outstanding requests and prevent | ||
2994 | * attempts to sync dirty data. | ||
2995 | */ | ||
2996 | nvme_dev_shutdown(dev); | ||
2997 | } | ||
2980 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) | 2998 | list_for_each_entry_safe(ns, next, &dev->namespaces, list) |
2981 | nvme_ns_remove(ns); | 2999 | nvme_ns_remove(ns); |
2982 | } | 3000 | } |