Skip to content

Commit 8c5c660

Browse files
jsmart-ghChristoph Hellwig
authored andcommitted
nvme-fc: Revert "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. Fixes: 863fbae ("nvme_fc: add module to ops template to allow module references") Cc: <[email protected]> # v5.4+ Signed-off-by: James Smart <[email protected]> Reviewed-by: Himanshu Madhani <[email protected]> Signed-off-by: Christoph Hellwig <[email protected]>
1 parent 657f197 commit 8c5c660

File tree

5 files changed

+2
-20
lines changed

5 files changed

+2
-20
lines changed

drivers/nvme/host/fc.c

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,7 @@ nvme_fc_register_localport(struct nvme_fc_port_info *pinfo,
342342
!template->ls_req || !template->fcp_io ||
343343
!template->ls_abort || !template->fcp_abort ||
344344
!template->max_hw_queues || !template->max_sgl_segments ||
345-
!template->max_dif_sgl_segments || !template->dma_boundary ||
346-
!template->module) {
345+
!template->max_dif_sgl_segments || !template->dma_boundary) {
347346
ret = -EINVAL;
348347
goto out_reghost_failed;
349348
}
@@ -2016,7 +2015,6 @@ nvme_fc_ctrl_free(struct kref *ref)
20162015
{
20172016
struct nvme_fc_ctrl *ctrl =
20182017
container_of(ref, struct nvme_fc_ctrl, ref);
2019-
struct nvme_fc_lport *lport = ctrl->lport;
20202018
unsigned long flags;
20212019

20222020
if (ctrl->ctrl.tagset) {
@@ -2043,7 +2041,6 @@ nvme_fc_ctrl_free(struct kref *ref)
20432041
if (ctrl->ctrl.opts)
20442042
nvmf_free_options(ctrl->ctrl.opts);
20452043
kfree(ctrl);
2046-
module_put(lport->ops->module);
20472044
}
20482045

20492046
static void
@@ -3074,15 +3071,10 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
30743071
goto out_fail;
30753072
}
30763073

3077-
if (!try_module_get(lport->ops->module)) {
3078-
ret = -EUNATCH;
3079-
goto out_free_ctrl;
3080-
}
3081-
30823074
idx = ida_simple_get(&nvme_fc_ctrl_cnt, 0, 0, GFP_KERNEL);
30833075
if (idx < 0) {
30843076
ret = -ENOSPC;
3085-
goto out_mod_put;
3077+
goto out_free_ctrl;
30863078
}
30873079

30883080
ctrl->ctrl.opts = opts;
@@ -3232,8 +3224,6 @@ nvme_fc_init_ctrl(struct device *dev, struct nvmf_ctrl_options *opts,
32323224
out_free_ida:
32333225
put_device(ctrl->dev);
32343226
ida_simple_remove(&nvme_fc_ctrl_cnt, ctrl->cnum);
3235-
out_mod_put:
3236-
module_put(lport->ops->module);
32373227
out_free_ctrl:
32383228
kfree(ctrl);
32393229
out_fail:

drivers/nvme/target/fcloop.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -875,7 +875,6 @@ fcloop_targetport_delete(struct nvmet_fc_target_port *targetport)
875875
#define FCLOOP_DMABOUND_4G 0xFFFFFFFF
876876

877877
static struct nvme_fc_port_template fctemplate = {
878-
.module = THIS_MODULE,
879878
.localport_delete = fcloop_localport_delete,
880879
.remoteport_delete = fcloop_remoteport_delete,
881880
.create_queue = fcloop_create_queue,

drivers/scsi/lpfc/lpfc_nvme.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1985,8 +1985,6 @@ lpfc_nvme_fcp_abort(struct nvme_fc_local_port *pnvme_lport,
19851985

19861986
/* Declare and initialization an instance of the FC NVME template. */
19871987
static struct nvme_fc_port_template lpfc_nvme_template = {
1988-
.module = THIS_MODULE,
1989-
19901988
/* initiator-based functions */
19911989
.localport_delete = lpfc_nvme_localport_delete,
19921990
.remoteport_delete = lpfc_nvme_remoteport_delete,

drivers/scsi/qla2xxx/qla_nvme.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,6 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport)
610610
}
611611

612612
static struct nvme_fc_port_template qla_nvme_fc_transport = {
613-
.module = THIS_MODULE,
614613
.localport_delete = qla_nvme_localport_delete,
615614
.remoteport_delete = qla_nvme_remoteport_delete,
616615
.create_queue = qla_nvme_alloc_queue,

include/linux/nvme-fc-driver.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -270,8 +270,6 @@ struct nvme_fc_remote_port {
270270
*
271271
* Host/Initiator Transport Entrypoints/Parameters:
272272
*
273-
* @module: The LLDD module using the interface
274-
*
275273
* @localport_delete: The LLDD initiates deletion of a localport via
276274
* nvme_fc_deregister_localport(). However, the teardown is
277275
* asynchronous. This routine is called upon the completion of the
@@ -385,8 +383,6 @@ struct nvme_fc_remote_port {
385383
* Value is Mandatory. Allowed to be zero.
386384
*/
387385
struct nvme_fc_port_template {
388-
struct module *module;
389-
390386
/* initiator-based functions */
391387
void (*localport_delete)(struct nvme_fc_local_port *);
392388
void (*remoteport_delete)(struct nvme_fc_remote_port *);

0 commit comments

Comments
 (0)