git: ff4633d9f897 - main - cam_periph: Comment about why we need to reset cbfcnp

From: Warner Losh <imp_at_FreeBSD.org>
Date: Fri, 21 Jul 2023 16:14:09 UTC
The branch main has been updated by imp:

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

commit ff4633d9f897c2247bc67930740509a1ba315c81
Author:     Warner Losh <imp@FreeBSD.org>
AuthorDate: 2023-07-21 16:11:37 +0000
Commit:     Warner Losh <imp@FreeBSD.org>
CommitDate: 2023-07-21 16:11:37 +0000

    cam_periph: Comment about why we need to reset cbfcnp
    
    Just spent a few minutes puzzling out why we do this. Add a comment to
    remind my future self (and other intersted folk) why we do the reset
    here when we'd set it a few lines above.
    
    Sponsored by:           Netflix
---
 sys/cam/cam_periph.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/sys/cam/cam_periph.c b/sys/cam/cam_periph.c
index 9ff3d156023d..0de73cffdc1f 100644
--- a/sys/cam/cam_periph.c
+++ b/sys/cam/cam_periph.c
@@ -1298,6 +1298,11 @@ cam_periph_runccb(union ccb *ccb,
 			if ((ccb->ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP)
 				error = 0;
 			else if (error_routine != NULL) {
+				/*
+				 * cbfcnp is modified by cam_periph_ccbwait so
+				 * reset it before we call the error routine
+				 * which may call xpt_done.
+				 */
 				ccb->ccb_h.cbfcnp = cam_periph_done;
 				error = (*error_routine)(ccb, camflags, sense_flags);
 			} else