From e0ceec676dc86ddca960a9858ae5e3a4e0c8390d Mon Sep 17 00:00:00 2001 From: Wojciech Macek Date: Mon, 20 Dec 2021 06:32:51 +0100 Subject: [PATCH] cam: don't send scsi commands on shutdown when reboot method RB_NOSYNC Don't send the SCSI comand SYNCHRONIZE CACHE on devices that are still open when RB_NOSYNC is the reboot method. This may avoid recursive panics when doadump is called due to a SCSI/CAM/USB error/bug. Obtained from: Semihalf Sponsored by: Stormshield Reviewed by: imp Differential revision: https://reviews.freebsd.org/D31549 --- sys/cam/scsi/scsi_da.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/sys/cam/scsi/scsi_da.c b/sys/cam/scsi/scsi_da.c index 0bcbccc7eab9..243e86d18caa 100644 --- a/sys/cam/scsi/scsi_da.c +++ b/sys/cam/scsi/scsi_da.c @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -6245,6 +6246,9 @@ dashutdown(void * arg, int howto) union ccb *ccb; int error; + if ((howto & RB_NOSYNC) != 0) + return; + CAM_PERIPH_FOREACH(periph, &dadriver) { softc = (struct da_softc *)periph->softc; if (SCHEDULER_STOPPED()) {