cam: Don't permit crashdumps on non-pollable devices.

If a disk's SIM doesn't support polling, then it can't be used to
store crashdumps.  Leave d_dump NULL in that case so that dumpon(8)
fails gracefully rather than having dumps fail at crash time.

Reviewed by:	scottl, mav, imp
MFC after:	2 weeks
Sponsored by:	Chelsio
Differential Revision:	https://reviews.freebsd.org/D28454
This commit is contained in:
John Baldwin 2021-02-11 13:51:01 -08:00
parent 447b3557a9
commit e07ac3f2fd
3 changed files with 7 additions and 4 deletions

View File

@ -1880,7 +1880,8 @@ adaregister(struct cam_periph *periph, void *arg)
softc->disk->d_close = adaclose;
softc->disk->d_strategy = adastrategy;
softc->disk->d_getattr = adagetattr;
softc->disk->d_dump = adadump;
if (cam_sim_pollable(periph->sim))
softc->disk->d_dump = adadump;
softc->disk->d_gone = adadiskgonecb;
softc->disk->d_name = "ada";
softc->disk->d_drv1 = periph;

View File

@ -898,7 +898,8 @@ ndaregister(struct cam_periph *periph, void *arg)
disk->d_strategy = ndastrategy;
disk->d_ioctl = ndaioctl;
disk->d_getattr = ndagetattr;
disk->d_dump = ndadump;
if (cam_sim_pollable(periph->sim))
disk->d_dump = ndadump;
disk->d_gone = ndadiskgonecb;
disk->d_name = "nda";
disk->d_drv1 = periph;

View File

@ -2849,7 +2849,7 @@ daregister(struct cam_periph *periph, void *arg)
TASK_INIT(&softc->sysctl_task, 0, dasysctlinit, periph);
/*
* Take an exclusive section lock qon the periph while dastart is called
* Take an exclusive section lock on the periph while dastart is called
* to finish the probe. The lock will be dropped in dadone at the end
* of probe. This locks out daopen and daclose from racing with the
* probe.
@ -2914,7 +2914,8 @@ daregister(struct cam_periph *periph, void *arg)
softc->disk->d_open = daopen;
softc->disk->d_close = daclose;
softc->disk->d_strategy = dastrategy;
softc->disk->d_dump = dadump;
if (cam_sim_pollable(periph->sim))
softc->disk->d_dump = dadump;
softc->disk->d_getattr = dagetattr;
softc->disk->d_gone = dadiskgonecb;
softc->disk->d_name = "da";