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 <nathan@kernel.org>
Closes: https://lore.kernel.org/all/20261016023120.GA2863622@ax162/
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Tested-by: Nathan Chancellor <nathan@kernel.org> # build
Link: https://patch.msgid.link/3c41b84d7d832dd767b30bc04cf875f800ce748d.1792283587.git.bvanassche@acm.org
Signed-off-by: Martin K. Petersen (Oracle) <mkp@kernel.org>
This commit is contained in:
Bart Van Assche 2026-10-17 17:40:51 -07:00 committed by Martin K. Petersen (Oracle)
parent 2327df6d2a
commit cd02f87668

View File

@ -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;