git: c351a6ec918e - stable/14 - mpi3mr: Only set callout_owned when we create a timeout

From: Alexander Motin <mav_at_FreeBSD.org>
Date: Fri, 19 Jan 2024 17:17:33 UTC
The branch stable/14 has been updated by mav:

URL: https://cgit.FreeBSD.org/src/commit/?id=c351a6ec918ea33e2abdc012deeb7b77d3a90e5f

commit c351a6ec918ea33e2abdc012deeb7b77d3a90e5f
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-29 01:49:24 +0000
Commit:     Alexander Motin <mav@FreeBSD.org>
CommitDate: 2024-01-19 17:16:49 +0000

    mpi3mr: Only set callout_owned when we create a timeout
    
    Since we assume there's a timeout to cancel when this is true, only set
    it true when we set the timeout. Otherwise we may try to cancel a timeout
    when there's been an error in submission.
    
    Sponsored by:           Netflix
    Reviewed by:            mav
    Differential Revision:  https://reviews.freebsd.org/D42541
    
    (cherry picked from commit 1cfd01111eb6a28ca5043e928aa8e9099064177a)
---
 sys/dev/mpi3mr/mpi3mr_cam.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sys/dev/mpi3mr/mpi3mr_cam.c b/sys/dev/mpi3mr/mpi3mr_cam.c
index 9b85ee8301dd..44b613ad7915 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1223,15 +1223,15 @@ mpi3mr_action_scsiio(struct mpi3mr_cam_softc *cam_sc, union ccb *ccb)
 		mpi3mr_set_ccbstatus(ccb, CAM_RESRC_UNAVAIL);
 		xpt_done(ccb);
 	} else {
-		callout_reset_sbt(&cm->callout, SBT_1S * 90 , 0,
-				  mpi3mr_scsiio_timeout, cm, 0);
+		callout_reset_sbt(&cm->callout, mstosbt(ccb->ccb_h.timeout), 0,
+		    mpi3mr_scsiio_timeout, cm, 0);
+		cm->callout_owner = true;
 		mpi3mr_atomic_inc(&sc->fw_outstanding);
 		mpi3mr_atomic_inc(&targ->outstanding);
 		if (mpi3mr_atomic_read(&sc->fw_outstanding) > sc->io_cmds_highwater)
 			sc->io_cmds_highwater++;
 	}
 
-	cm->callout_owner = true;
 	return;
 }