* [PATCH] scsi: fnic: Annotate fnic_nvme functions with __must_hold()
@ 2026-10-18 0:40 Bart Van Assche
2026-10-18 21:22 ` Nathan Chancellor
0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2026-10-18 0:40 UTC (permalink / raw)
To: Martin K . Petersen
Cc: linux-scsi, Bart Van Assche, Nathan Chancellor, Satish Kharat,
Sesidhar Baddela, Karan Tilak Kumar, James E.J. Bottomley,
Martin K. Petersen
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>
---
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;
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] scsi: fnic: Annotate fnic_nvme functions with __must_hold()
2026-10-18 0:40 [PATCH] scsi: fnic: Annotate fnic_nvme functions with __must_hold() Bart Van Assche
@ 2026-10-18 21:22 ` Nathan Chancellor
0 siblings, 0 replies; 2+ messages in thread
From: Nathan Chancellor @ 2026-10-18 21:22 UTC (permalink / raw)
To: Bart Van Assche
Cc: Martin K . Petersen, linux-scsi, Satish Kharat, Sesidhar Baddela,
Karan Tilak Kumar, James E.J. Bottomley, Martin K. Petersen
On Sat, Oct 17, 2026 at 05:40:51PM -0700, Bart Van Assche wrote:
> 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
> ---
> 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;
--
Cheers,
Nathan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-10-18 21:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-18 0:40 [PATCH] scsi: fnic: Annotate fnic_nvme functions with __must_hold() Bart Van Assche
2026-10-18 21:22 ` Nathan Chancellor
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.