[PATCH 2/3] nvmet: use port's tr_ops in nvmet_disable_port

Max Gurtovoy mgurtovoy at nvidia.com
Sat Sep 20 16:49:42 PDT 2025


Use the port's tr_ops pointer when disabling a port, instead of looking
up the ops by the transport type. An enabled port is guaranteed to have
a valid reference to its fabrics ops.

Signed-off-by: Max Gurtovoy <mgurtovoy at nvidia.com>
---
 drivers/nvme/target/core.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index 9f5159f04bbd..f31c7fa70740 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -388,10 +388,11 @@ void nvmet_disable_port(struct nvmet_port *port)
 	if (!port->enabled)
 		return;
 
+	ops = port->tr_ops;
+
 	port->enabled = false;
 	port->tr_ops = NULL;
 
-	ops = nvmet_transports[port->disc_addr.trtype];
 	ops->remove_port(port);
 	module_put(ops->owner);
 }
-- 
2.18.1




More information about the Linux-nvme mailing list