From 91a600d894ae94f9c923f733d8c6d083de1eb97a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Thu, 26 Dec 2019 00:25:21 +0000 Subject: [PATCH] qla2x00t-32gbit: add module to ops template to allow module references In nvme-fc: it's possible to have connected active controllers and as no references are taken on the LLDD, the LLDD can be unloaded. The controller would enter a reconnect state and as long as the LLDD resumed within the reconnect timeout, the controller would resume. But if a namespace on the controller is the root device, allowing the driver to unload can be problematic. To reload the driver, it may require new io to the boot device, and as it's no longer connected we get into a catch-22 that eventually fails, and the system locks up. Fix this issue by taking a module reference for every connected controller (which is what the core layer did to the transport module). Reference is cleared when the controller is removed. Acked-by: Himanshu Madhani Reviewed-by: Christoph Hellwig Signed-off-by: James Smart Signed-off-by: Keith Busch [ commit 863fbae929c7a5b64e96b8a3ffb34a29eefb9f8f upstream ] git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@8723 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- qla2x00t-32gbit/qla_nvme.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/qla2x00t-32gbit/qla_nvme.c b/qla2x00t-32gbit/qla_nvme.c index 85320e615..5b7f4abdc 100644 --- a/qla2x00t-32gbit/qla_nvme.c +++ b/qla2x00t-32gbit/qla_nvme.c @@ -621,6 +621,13 @@ static void qla_nvme_remoteport_delete(struct nvme_fc_remote_port *rport) } static struct nvme_fc_port_template qla_nvme_fc_transport = { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 5, 0) + /* + * See also commit 863fbae929c7 ("nvme_fc: add module to ops template + * to allow module references"). + */ + .module = THIS_MODULE, +#endif .localport_delete = qla_nvme_localport_delete, .remoteport_delete = qla_nvme_remoteport_delete, .create_queue = qla_nvme_alloc_queue,