nvme-fc: Revert - add module to ops template to allow module references
Subsystems (7)
PATCH 1/1 nvme-fc: Revert - add module to ops template to allow module references
This patch reverts the commit for
nvme_fc: add module to ops template to allow module references
The original patch was to resolve the lldd being able to be unloaded while being used to talk to the boot device of the system. However, the end result of the original patch is that any driver unload while a nvme controller is live via the lldd is now being prohibited. Given the module reference, the module teardown routine can't be called, thus there's no way, other than manual actions to terminate the controllers.
-- james
--- drivers/nvme/host/fc.c | 14 ++------------ drivers/nvme/target/fcloop.c | 1 - drivers/scsi/lpfc/lpfc_nvme.c | 2 -- drivers/scsi/qla2xxx/qla_nvme.c | 1 - include/linux/nvme-fc-driver.h | 4 ---- 5 files changed, 2 insertions(+), 20 deletions(-)
drivers/nvme/host/fc.c +2 -12
@@ -342,8 +342,7 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary || - !template->module) { + !template->max_dif_sgl_segments || !template->dma_boundary) { ret = -EINVAL ; goto out_reghost_failed; }
@@ -2016,7 +2015,6 @@ nvme_fc_ctrl_free(struct kref *ref) {struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); -struct nvme_fc_lport *lport = ctrl->lport;unsigned long flags;if (ctrl->ctrl.tagset) {
@@ -2043,7 +2041,6 @@ nvme_fc_ctrl_free(struct kref *ref)if (ctrl->ctrl.opts)nvmf_free_options (ctrl->ctrl.opts);kfree (ctrl); -module_put (lport->ops->module); } static void
@@ -3074,15 +3071,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_fail; } -if (!try_module_get (lport->ops->module)) { - ret = -EUNATCH ; - goto out_free_ctrl; - } - idx =ida_simple_get (&nvme_fc_ctrl_cnt,0 ,0 ,GFP_KERNEL );if (idx <0 ) { ret = -ENOSPC ; - goto out_mod_put; + goto out_free_ctrl; } ctrl->ctrl.opts = opts;
@@ -3232,8 +3224,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, out_free_ida:put_device (ctrl->dev);ida_simple_remove (&nvme_fc_ctrl_cnt, ctrl->cnum); -out_mod_put: -module_put (lport->ops->module); out_free_ctrl:kfree (ctrl); out_fail:
drivers/nvme/target/fcloop.c +0 -1
@@ -875,7 +875,6 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_DMABOUND_4G 0xFFFFFFFFstatic struct nvme_fc_port_template fctemplate = { - .module =THIS_MODULE , .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,
drivers/scsi/lpfc/lpfc_nvme.c +0 -2
@@ -1985,8 +1985,6 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,/* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { - .module =THIS_MODULE , -/* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete,
drivers/scsi/qla2xxx/qla_nvme.c +0 -1
@@ -610,7 +610,6 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) }static struct nvme_fc_port_template qla_nvme_fc_transport = { - .module =THIS_MODULE , .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,
include/linux/nvme-fc-driver.h +0 -4
@@ -270,8 +270,6 @@ struct nvme_fc_remote_port {* * Host/Initiator Transport Entrypoints/Parameters: * -* @module: The LLDD module using the interface -* * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the
@@ -385,8 +383,6 @@ struct nvme_fc_remote_port {* Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { -struct module *module; -/* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *);void (*remoteport_delete)(struct nvme_fc_remote_port *);
Signature · 1 line
2.16.4
Quoted 133 lines · James Smart
This patch reverts the commit for
nvme_fc: add module to ops template to allow module referencesThe original patch was to resolve the lldd being able to be unloaded while being used to talk to the boot device of the system. However, the end result of the original patch is that any driver unload while a nvme controller is live via the lldd is now being prohibited. Given the module reference, the module teardown routine can't be called, thus there's no way, other than manual actions to terminate the controllers.
-- james
Fixes 863fbae929c7 ("nvme_fc: add module to ops template to allow module references")Cc <[email protected]> # v5.4+Signed-off-by James Smart <[email protected]>Cc Himanshu Madhani <[email protected]>CC Christoph Hellwig <[email protected]>CC Keith Busch <[email protected]>--- drivers/nvme/host/fc.c | 14 ++------------ drivers/nvme/target/fcloop.c | 1 - drivers/scsi/lpfc/lpfc_nvme.c | 2 -- drivers/scsi/qla2xxx/qla_nvme.c | 1 - include/linux/nvme-fc-driver.h | 4 ---- 5 files changed, 2 insertions(+), 20 deletions(-)drivers/nvme/host/fc.c +2
-12@@ -342,8 +342,7 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo, !template->ls_req || !template->fcp_io || !template->ls_abort || !template->fcp_abort || !template->max_hw_queues || !template->max_sgl_segments || - !template->max_dif_sgl_segments || !template->dma_boundary || - !template->module) { + !template->max_dif_sgl_segments || !template->dma_boundary) { ret = -EINVAL ; goto out_reghost_failed; }@@ -2016,7 +2015,6 @@ nvme_fc_ctrl_free(struct kref *ref) {struct nvme_fc_ctrl *ctrl = container_of(ref, struct nvme_fc_ctrl, ref); -struct nvme_fc_lport *lport = ctrl->lport;unsigned long flags;if (ctrl->ctrl.tagset) {@@ -2043,7 +2041,6 @@ nvme_fc_ctrl_free(struct kref *ref)if (ctrl->ctrl.opts)nvmf_free_options (ctrl->ctrl.opts);kfree (ctrl); -module_put (lport->ops->module); } static void@@ -3074,15 +3071,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, goto out_fail; } -if (!try_module_get (lport->ops->module)) { - ret = -EUNATCH ; - goto out_free_ctrl; - } - idx =ida_simple_get (&nvme_fc_ctrl_cnt,0 ,0 ,GFP_KERNEL );if (idx <0 ) { ret = -ENOSPC ; - goto out_mod_put; + goto out_free_ctrl; } ctrl->ctrl.opts = opts;@@ -3232,8 +3224,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts, out_free_ida:put_device (ctrl->dev);ida_simple_remove (&nvme_fc_ctrl_cnt, ctrl->cnum); -out_mod_put: -module_put (lport->ops->module); out_free_ctrl:kfree (ctrl); out_fail:drivers/nvme/target/fcloop.c +0
-1@@ -875,7 +875,6 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)#define FCLOOP_DMABOUND_4G 0xFFFFFFFFstatic struct nvme_fc_port_template fctemplate = { - .module =THIS_MODULE , .localport_delete = fcloop_localport_delete, .remoteport_delete = fcloop_remoteport_delete, .create_queue = fcloop_create_queue,drivers/scsi/lpfc/lpfc_nvme.c +0
-2@@ -1985,8 +1985,6 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,/* Declare and initialization an instance of the FC NVME template. */ static struct nvme_fc_port_template lpfc_nvme_template = { - .module =THIS_MODULE , -/* initiator-based functions */ .localport_delete = lpfc_nvme_localport_delete, .remoteport_delete = lpfc_nvme_remoteport_delete,drivers/scsi/qla2xxx/qla_nvme.c +0
-1@@ -610,7 +610,6 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) }static struct nvme_fc_port_template qla_nvme_fc_transport = { - .module =THIS_MODULE , .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,include/linux/nvme-fc-driver.h +0
-2@@ -270,8 +270,6 @@ struct nvme_fc_remote_port {* * Host/Initiator Transport Entrypoints/Parameters: * -* @module: The LLDD module using the interface -* * @localport_delete: The LLDD initiates deletion of a localport via * nvme_fc_deregister_localport(). However, the teardown is * asynchronous. This routine is called upon the completion of the
include/linux/nvme-fc-driver.h struct nvme_fc_remote_port { · line 388
Quoted 8 lines
include/linux/nvme-fc-driver.h +0
-2@@ -385,8 +383,6 @@ struct nvme_fc_remote_port {* Value is Mandatory. Allowed to be zero. */ struct nvme_fc_port_template { -struct module *module; -/* initiator-based functions */ void (*localport_delete)(struct nvme_fc_local_port *);void (*remoteport_delete)(struct nvme_fc_remote_port *);
_______________________________________________
linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Thanks,
applied to nvme-5.7.