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
This commit is contained in:
Wojciech Macek 2021-12-20 06:32:51 +01:00
parent 4f741801d8
commit e0ceec676d

View File

@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <sys/cons.h>
#include <sys/endian.h>
#include <sys/proc.h>
#include <sys/reboot.h>
#include <sys/sbuf.h>
#include <geom/geom.h>
#include <geom/geom_disk.h>
@ -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()) {