Skip to contentSkip to conversation

nvme: fix controller ioctl through ns_head

PATCH Applied Minwoo Im 2 participants 3 messages Apr 22, 2021 – Apr 28, 2021 NVMe

lore
Share & tools
lore

Minwoo Im

author
#0 lore raw

v2 cover nvme: fix controller ioctl through ns_head

Hello,

This series is to fix controller ioctl through the ns_head block device and the per-namespace generic device. This patch is mostly manual revert for the commit 3557a4409701 ("nvme: don't bother to look up a namespace for controller ioctls") with few more updates to the generic device.

Please review.

Thanks,

Since V1:
- Manually revert 3557a4409701 ("nvme: don't bother to look up a namespace for controller ioctls"). (Christoph)
- Updates nvme_ns_head_chr_ioctl() which has been newly added for generic per-namespace chardev.

Minwoo Im (1):
nvme: fix controller ioctl through ns_head

 drivers/nvme/host/core.c  | 22 -------------
 drivers/nvme/host/ioctl.c | 65 ++++++++++++++++++++++++---------------
 drivers/nvme/host/nvme.h  |  1 -
 3 files changed, 41 insertions(+), 47 deletions(-)
Signature · 7 lines
2.27.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
author
#1 lore raw

PATCH v2 1/1 nvme: fix controller ioctl through ns_head

In multipath case, we should consider namespace attachment with controllers in a subsystem when we find out the live controller for the namespace. This patch manually reverted the commit 3557a4409701 ("nvme: don't bother to look up a namespace for controller ioctls") with few more updates to nvme_ns_head_chr_ioctl which has been newly updated.

Fixes 3557a4409701 ("nvme: don't bother to look up a namespace for

controller ioctls")

Cc Christoph Hellwig <[email protected]>
---
 drivers/nvme/host/core.c  | 22 -------------
 drivers/nvme/host/ioctl.c | 65 ++++++++++++++++++++++++---------------
 drivers/nvme/host/nvme.h  |  1 -
 3 files changed, 41 insertions(+), 47 deletions(-)
drivers/nvme/host/core.c +0 -22
index 2f45e8fcdd7c..f6db097ad776 100644
@@ -2009,28 +2009,6 @@ static const struct block_device_operations nvme_bdev_ops = {
 	.pr_ops		= &nvme_pr_ops,
 };
 
-#ifdef CONFIG_NVME_MULTIPATH
-struct nvme_ctrl *nvme_find_get_live_ctrl(struct nvme_subsystem *subsys)
-{
-	struct nvme_ctrl *ctrl;
-	int ret;
-
-	ret = mutex_lock_killable(&nvme_subsystems_lock);
-	if (ret)
-		return ERR_PTR(ret);
-	list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) {
-		if (ctrl->state == NVME_CTRL_LIVE)
-			goto found;
-	}
-	mutex_unlock(&nvme_subsystems_lock);
-	return ERR_PTR(-EWOULDBLOCK);
-found:
-	nvme_get_ctrl(ctrl);
-	mutex_unlock(&nvme_subsystems_lock);
-	return ctrl;
-}
-#endif /* CONFIG_NVME_MULTIPATH */
-
 static int nvme_wait_ready(struct nvme_ctrl *ctrl, u64 cap, bool enabled)
 {
 	unsigned long timeout =
drivers/nvme/host/ioctl.c +41 -24

92 lines not on this page · raw message

drivers/nvme/host/nvme.h +0 -1
index 773dde5b231d..c1e086a0bc3f 100644
@@ -664,7 +664,6 @@ struct nvme_ns *nvme_get_ns_from_disk(struct gendisk *disk,
 void nvme_put_ns_from_disk(struct nvme_ns_head *head, int idx);
 bool nvme_tryget_ns_head(struct nvme_ns_head *head);
 void nvme_put_ns_head(struct nvme_ns_head *head);
-struct nvme_ctrl *nvme_find_get_live_ctrl(struct nvme_subsystem *subsys);
 int nvme_cdev_add(struct cdev *cdev, struct device *cdev_device,
 		const struct file_operations *fops, struct module *owner);
 void nvme_cdev_del(struct cdev *cdev, struct device *cdev_device);
Signature · 7 lines
2.27.0


_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme