git: 1cfd01111eb6 - main - mpi3mr: Only set callout_owned when we create a timeout

From: Warner Losh <imp_at_FreeBSD.org>
Date: Wed, 29 Nov 2023 01:55:34 UTC
The branch main has been updated by imp:

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

commit 1cfd01111eb6a28ca5043e928aa8e9099064177a
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-11-29 01:49:24 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-11-29 01:49:24 +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
---
 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 430550e3edce..691be827cf89 100644
--- a/sys/dev/mpi3mr/mpi3mr_cam.c
+++ b/sys/dev/mpi3mr/mpi3mr_cam.c
@@ -1222,15 +1222,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;
 }