Skip to content

Commit baa0ab2

Browse files
committed
Merge tag 'nvme-5.15-2021-10-14' of git://git.infradead.org/nvme into block-5.15
Pull NVMe fixes from Christoph: "nvme fixes for Linux 5.15: - fix the abort command id (Keith Busch) - nvme: fix per-namespace chardev deletion (Adam Manzanares)" * tag 'nvme-5.15-2021-10-14' of git://git.infradead.org/nvme: nvme: fix per-namespace chardev deletion nvme-pci: Fix abort command id
2 parents 7904022 + be5eb93 commit baa0ab2

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

drivers/nvme/host/core.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3550,10 +3550,15 @@ static int __nvme_check_ids(struct nvme_subsystem *subsys,
35503550
return 0;
35513551
}
35523552

3553+
static void nvme_cdev_rel(struct device *dev)
3554+
{
3555+
ida_simple_remove(&nvme_ns_chr_minor_ida, MINOR(dev->devt));
3556+
}
3557+
35533558
void nvme_cdev_del(struct cdev *cdev, struct device *cdev_device)
35543559
{
35553560
cdev_device_del(cdev, cdev_device);
3556-
ida_simple_remove(&nvme_ns_chr_minor_ida, MINOR(cdev_device->devt));
3561+
put_device(cdev_device);
35573562
}
35583563

35593564
int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
@@ -3566,14 +3571,14 @@ int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
35663571
return minor;
35673572
cdev_device->devt = MKDEV(MAJOR(nvme_ns_chr_devt), minor);
35683573
cdev_device->class = nvme_ns_chr_class;
3574+
cdev_device->release = nvme_cdev_rel;
35693575
device_initialize(cdev_device);
35703576
cdev_init(cdev, fops);
35713577
cdev->owner = owner;
35723578
ret = cdev_device_add(cdev, cdev_device);
3573-
if (ret) {
3579+
if (ret)
35743580
put_device(cdev_device);
3575-
ida_simple_remove(&nvme_ns_chr_minor_ida, minor);
3576-
}
3581+
35773582
return ret;
35783583
}
35793584

@@ -3605,11 +3610,9 @@ static int nvme_add_ns_cdev(struct nvme_ns *ns)
36053610
ns->ctrl->instance, ns->head->instance);
36063611
if (ret)
36073612
return ret;
3608-
ret = nvme_cdev_add(&ns->cdev, &ns->cdev_device, &nvme_ns_chr_fops,
3609-
ns->ctrl->ops->module);
3610-
if (ret)
3611-
kfree_const(ns->cdev_device.kobj.name);
3612-
return ret;
3613+
3614+
return nvme_cdev_add(&ns->cdev, &ns->cdev_device, &nvme_ns_chr_fops,
3615+
ns->ctrl->ops->module);
36133616
}
36143617

36153618
static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,

drivers/nvme/host/multipath.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,8 +431,6 @@ static int nvme_add_ns_head_cdev(struct nvme_ns_head *head)
431431
return ret;
432432
ret = nvme_cdev_add(&head->cdev, &head->cdev_device,
433433
&nvme_ns_head_chr_fops, THIS_MODULE);
434-
if (ret)
435-
kfree_const(head->cdev_device.kobj.name);
436434
return ret;
437435
}
438436

drivers/nvme/host/pci.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,7 @@ static enum blk_eh_timer_return nvme_timeout(struct request *req, bool reserved)
13301330
iod->aborted = 1;
13311331

13321332
cmd.abort.opcode = nvme_admin_abort_cmd;
1333-
cmd.abort.cid = req->tag;
1333+
cmd.abort.cid = nvme_cid(req);
13341334
cmd.abort.sqid = cpu_to_le16(nvmeq->qid);
13351335

13361336
dev_warn(nvmeq->dev->ctrl.device,

0 commit comments

Comments
 (0)