Skip to content

Commit 7b8731d

Browse files
committed
Merge tag 'block-5.9-2020-09-11' of git://git.kernel.dk/linux-block
Pull block fixes from Jens Axboe: - Fix a regression in bdev partition locking (Christoph) - NVMe pull request from Christoph: - cancel async events before freeing them (David Milburn) - revert a broken race fix (James Smart) - fix command processing during resets (Sagi Grimberg) - Fix a kyber crash with requeued flushes (Omar) - Fix __bio_try_merge_page() same_page error for no merging (Ritesh) * tag 'block-5.9-2020-09-11' of git://git.kernel.dk/linux-block: block: Set same_page to false in __bio_try_merge_page if ret is false nvme-fabrics: allow to queue requests for live queues block: only call sched requeue_request() for scheduled requests nvme-tcp: cancel async events before freeing event struct nvme-rdma: cancel async events before freeing event struct nvme-fc: cancel async events before freeing event struct nvme: Revert: Fix controller creation races with teardown flow block: restore a specific error code in bdev_del_partition
2 parents e8878ab + fd04358 commit 7b8731d

File tree

10 files changed

+16
-25
lines changed

10 files changed

+16
-25
lines changed

block/bfq-iosched.c

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5895,18 +5895,6 @@ static void bfq_finish_requeue_request(struct request *rq)
58955895
struct bfq_queue *bfqq = RQ_BFQQ(rq);
58965896
struct bfq_data *bfqd;
58975897

5898-
/*
5899-
* Requeue and finish hooks are invoked in blk-mq without
5900-
* checking whether the involved request is actually still
5901-
* referenced in the scheduler. To handle this fact, the
5902-
* following two checks make this function exit in case of
5903-
* spurious invocations, for which there is nothing to do.
5904-
*
5905-
* First, check whether rq has nothing to do with an elevator.
5906-
*/
5907-
if (unlikely(!(rq->rq_flags & RQF_ELVPRIV)))
5908-
return;
5909-
59105898
/*
59115899
* rq either is not associated with any icq, or is an already
59125900
* requeued request that has not (yet) been re-inserted into

block/bio.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -879,8 +879,10 @@ bool __bio_try_merge_page(struct bio *bio, struct page *page,
879879
struct bio_vec *bv = &bio->bi_io_vec[bio->bi_vcnt - 1];
880880

881881
if (page_is_mergeable(bv, page, len, off, same_page)) {
882-
if (bio->bi_iter.bi_size > UINT_MAX - len)
882+
if (bio->bi_iter.bi_size > UINT_MAX - len) {
883+
*same_page = false;
883884
return false;
885+
}
884886
bv->bv_len += len;
885887
bio->bi_iter.bi_size += len;
886888
return true;

block/blk-mq-sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ static inline void blk_mq_sched_requeue_request(struct request *rq)
6666
struct request_queue *q = rq->q;
6767
struct elevator_queue *e = q->elevator;
6868

69-
if (e && e->type->ops.requeue_request)
69+
if ((rq->rq_flags & RQF_ELVPRIV) && e && e->type->ops.requeue_request)
7070
e->type->ops.requeue_request(rq);
7171
}
7272

block/partitions/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ int bdev_del_partition(struct block_device *bdev, int partno)
537537

538538
bdevp = bdget_disk(bdev->bd_disk, partno);
539539
if (!bdevp)
540-
return -ENOMEM;
540+
return -ENXIO;
541541

542542
mutex_lock(&bdevp->bd_mutex);
543543
mutex_lock_nested(&bdev->bd_mutex, 1);

drivers/nvme/host/core.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3525,10 +3525,6 @@ static ssize_t nvme_sysfs_delete(struct device *dev,
35253525
{
35263526
struct nvme_ctrl *ctrl = dev_get_drvdata(dev);
35273527

3528-
/* Can't delete non-created controllers */
3529-
if (!ctrl->created)
3530-
return -EBUSY;
3531-
35323528
if (device_remove_file_self(dev, attr))
35333529
nvme_delete_ctrl_sync(ctrl);
35343530
return count;
@@ -4403,7 +4399,6 @@ void nvme_start_ctrl(struct nvme_ctrl *ctrl)
44034399
nvme_queue_scan(ctrl);
44044400
nvme_start_queues(ctrl);
44054401
}
4406-
ctrl->created = true;
44074402
}
44084403
EXPORT_SYMBOL_GPL(nvme_start_ctrl);
44094404

drivers/nvme/host/fabrics.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,14 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
565565
struct nvme_request *req = nvme_req(rq);
566566

567567
/*
568-
* If we are in some state of setup or teardown only allow
569-
* internally generated commands.
568+
* currently we have a problem sending passthru commands
569+
* on the admin_q if the controller is not LIVE because we can't
570+
* make sure that they are going out after the admin connect,
571+
* controller enable and/or other commands in the initialization
572+
* sequence. until the controller will be LIVE, fail with
573+
* BLK_STS_RESOURCE so that they will be rescheduled.
570574
*/
571-
if (!blk_rq_is_passthrough(rq) || (req->flags & NVME_REQ_USERCMD))
575+
if (rq->q == ctrl->admin_q && (req->flags & NVME_REQ_USERCMD))
572576
return false;
573577

574578
/*
@@ -577,7 +581,7 @@ bool __nvmf_check_ready(struct nvme_ctrl *ctrl, struct request *rq,
577581
*/
578582
switch (ctrl->state) {
579583
case NVME_CTRL_CONNECTING:
580-
if (nvme_is_fabrics(req->cmd) &&
584+
if (blk_rq_is_passthrough(rq) && nvme_is_fabrics(req->cmd) &&
581585
req->cmd->fabrics.fctype == nvme_fabrics_type_connect)
582586
return true;
583587
break;

drivers/nvme/host/fc.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2160,6 +2160,7 @@ nvme_fc_term_aen_ops(struct nvme_fc_ctrl *ctrl)
21602160
struct nvme_fc_fcp_op *aen_op;
21612161
int i;
21622162

2163+
cancel_work_sync(&ctrl->ctrl.async_event_work);
21632164
aen_op = ctrl->aen_ops;
21642165
for (i = 0; i < NVME_NR_AEN_COMMANDS; i++, aen_op++) {
21652166
__nvme_fc_exit_request(ctrl, aen_op);

drivers/nvme/host/nvme.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,6 @@ struct nvme_ctrl {
307307
struct nvme_command ka_cmd;
308308
struct work_struct fw_act_work;
309309
unsigned long events;
310-
bool created;
311310

312311
#ifdef CONFIG_NVME_MULTIPATH
313312
/* asymmetric namespace access: */

drivers/nvme/host/rdma.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -835,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
835835
blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
836836
}
837837
if (ctrl->async_event_sqe.data) {
838+
cancel_work_sync(&ctrl->ctrl.async_event_work);
838839
nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
839840
sizeof(struct nvme_command), DMA_TO_DEVICE);
840841
ctrl->async_event_sqe.data = NULL;

drivers/nvme/host/tcp.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1596,6 +1596,7 @@ static struct blk_mq_tag_set *nvme_tcp_alloc_tagset(struct nvme_ctrl *nctrl,
15961596
static void nvme_tcp_free_admin_queue(struct nvme_ctrl *ctrl)
15971597
{
15981598
if (to_tcp_ctrl(ctrl)->async_req.pdu) {
1599+
cancel_work_sync(&ctrl->async_event_work);
15991600
nvme_tcp_free_async_req(to_tcp_ctrl(ctrl));
16001601
to_tcp_ctrl(ctrl)->async_req.pdu = NULL;
16011602
}

0 commit comments

Comments
 (0)