linux/drivers/nvme/target
Justin Tee f30b95159a nvmet-fcloop: Check remoteport port_state before calling done callback
[ Upstream commit dd677d0598 ]

In nvme_fc_handle_ls_rqst_work, the lsrsp->done callback is only set when
remoteport->port_state is FC_OBJSTATE_ONLINE.  Otherwise, the
nvme_fc_xmt_ls_rsp's LLDD call to lport->ops->xmt_ls_rsp is expected to
fail and the nvme-fc transport layer itself will directly call
nvme_fc_xmt_ls_rsp_free instead of relying on LLDD's done callback to free
the lsrsp resources.

Update the fcloop_t2h_xmt_ls_rsp routine to check remoteport->port_state.
If online, then lsrsp->done callback will free the lsrsp.  Else, return
-ENODEV to signal the nvme-fc transport to handle freeing lsrsp.

Cc: Ewan D. Milne <emilne@redhat.com>
Tested-by: Aristeu Rozanski <aris@redhat.com>
Acked-by: Aristeu Rozanski <aris@redhat.com>
Reviewed-by: Daniel Wagner <dwagner@suse.de>
Closes: https://lore.kernel.org/linux-nvme/21255200-a271-4fa0-b099-97755c8acd4c@work/
Fixes: 10c165af35 ("nvmet-fcloop: call done callback even when remote port is gone")
Signed-off-by: Justin Tee <justintee8345@gmail.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
History 2026-03-12 07:09:49 -04:00
..
admin-cmd.c nvme: spelling fixes 2025-06-04 10:23:28 +02:00
auth.c nvmet-auth: update sc_c in target host hash calculation 2025-11-17 08:05:58 -08:00
configfs.c for-6.14/block-20250118 2025-01-20 19:38:46 -08:00
core.c nvmet: add safety check for subsys lock 2025-09-23 15:38:28 -07:00
debugfs.c These are objtool fixes and updates by Josh Poimboeuf, centered 2025-04-02 10:30:10 -07:00
debugfs.h nvmet: add debugfs support 2024-06-24 12:53:42 -07:00
discovery.c nvmet: replace strncpy with strscpy 2025-05-20 05:34:25 +02:00
fabrics-cmd-auth.c nvmet-auth: update sc_c in target host hash calculation 2025-11-17 08:05:58 -08:00
fabrics-cmd.c nvmet: fabrics: add CQ init and destroy 2025-05-20 05:34:25 +02:00
fc.c nvmet-fc: avoid scheduling association deletion twice 2025-09-15 08:52:57 -07:00
fcloop.c nvmet-fcloop: Check remoteport port_state before calling done callback 2026-03-12 07:09:49 -04:00
io-cmd-bdev.c nvmet: fix race in nvmet_bio_done() leading to NULL pointer dereference 2026-02-06 16:57:39 +01:00
io-cmd-file.c nvmet: use bvec_set_page to initialize bvecs 2023-02-03 08:20:55 -07:00
Kconfig crash_dump, nvme: select CONFIGFS_FS as built-in 2025-05-27 19:40:33 -07:00
loop.c nvmet: simplify the nvmet_req_init() interface 2025-05-20 05:34:26 +02:00
Makefile nvmet: New NVMe PCI endpoint function target driver 2025-01-10 19:30:49 -08:00
nvmet.h nvmet-auth: update sc_c in target host hash calculation 2025-11-17 08:05:58 -08:00
passthru.c nvmet: add support for FDP in fabrics passthru path 2025-07-31 06:35:43 -07:00
pci-epf.c nvmet: pci-epf: move DMA initialization to EPC init callback 2026-01-08 10:17:01 +01:00
pr.c nvmet-loop: avoid using mutex in IO hotpath 2024-12-27 13:24:00 -08:00
rdma.c nvme: fix various comment typos 2025-07-31 06:35:58 -07:00
tcp.c nvmet-tcp: fixup hang in nvmet_tcp_listen_data_ready() 2026-02-11 13:41:51 +01:00
trace.c nvmet: add tracing of reservation commands 2024-11-13 08:51:24 -08:00
trace.h nvme: trace: avoid memcpy overflow warning 2024-01-05 13:16:18 -08:00
zns.c nvme: fix multiple spelling and grammar issues in host drivers 2025-07-17 13:38:06 +02:00