From cd02f87668a8e8d8ff4e130f18990c3a9e7bb22a Mon Sep 17 00:00:00 2001 From: Bart Van Assche Date: Sat, 17 Oct 2026 17:40:51 -0700 Subject: [PATCH] scsi: fnic: Annotate fnic_nvme functions with __must_hold() Add __must_hold() annotations for fnic_lock to nvfnic_process_ls_abts_rsp(), nvfnic_ls_rsp_recv(), nvfnic_delete_tport(), and nvfnic_add_tport() in drivers/scsi/fnic/fnic_nvme.c. Document that callers must hold fnic_lock on entry and exit because these functions temporarily release and reacquire fnic_lock, and suppress context imbalance warnings reported by lock context analysis and sparse. Reported-by: Nathan Chancellor Closes: https://lore.kernel.org/all/20261016023120.GA2863622@ax162/ Signed-off-by: Bart Van Assche Tested-by: Nathan Chancellor # build Link: https://patch.msgid.link/3c41b84d7d832dd767b30bc04cf875f800ce748d.1792283587.git.bvanassche@acm.org Signed-off-by: Martin K. Petersen (Oracle) --- drivers/scsi/fnic/fnic_nvme.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/scsi/fnic/fnic_nvme.c b/drivers/scsi/fnic/fnic_nvme.c index 00d9d5d439a3..d1b327c5c5e0 100644 --- a/drivers/scsi/fnic/fnic_nvme.c +++ b/drivers/scsi/fnic/fnic_nvme.c @@ -1284,6 +1284,7 @@ void nvfnic_fcpio_cmpl(struct fnic_io_req *io_req) void nvfnic_process_ls_abts_rsp(struct fnic_iport_s *iport, struct fc_frame_header *fchdr) + __must_hold(&iport->fnic->fnic_lock) { uint32_t tport_fcid; struct fnic_tport_s *tport; @@ -1348,6 +1349,7 @@ void nvfnic_process_ls_abts_rsp(struct fnic_iport_s *iport, */ void nvfnic_ls_rsp_recv(struct fnic_iport_s *iport, struct fc_frame_header *fchdr, int len) + __must_hold(&iport->fnic->fnic_lock) { uint8_t *fcid; uint32_t tport_fcid; @@ -2086,6 +2088,7 @@ void nvfnic_exch_reset(struct fnic_iport_s *iport, struct fnic_tport_s *tport) void nvfnic_delete_tport(struct fnic_iport_s *iport, struct fnic_tport_s *tport, unsigned long flags) + __must_hold(&iport->fnic->fnic_lock) { struct fnic *fnic = iport->fnic; int ret; @@ -2179,6 +2182,7 @@ void nvfnic_delete_tport(struct fnic_iport_s *iport, int nvfnic_add_tport(struct fnic *fnic, struct fnic_tport_s *tport, unsigned long flags) + __must_hold(&fnic->fnic_lock) { struct fnic_iport_s *iport = &fnic->iport; struct nvme_fc_port_info pinfo;