mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
add a knob that disables detection of write protected disks
It has been reported that on some systems (with real hardware passed through to a virtual machine) the WP detection causes USB disk probing failures. While here, also fix the selection of the next state in the case of malloc failure in DA_STATE_PROBE_WP. It was DA_STATE_PROBE_RC unconditionally even when it should have been DA_STATE_PROBE_RC16. PR: 225794 Reported by: David Boyd <David.Boyd49@twc.com> MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D18496
This commit is contained in:
parent
b7841ae650
commit
5b7f9fada1
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=342169
|
@ -1469,6 +1469,7 @@ static int da_retry_count = DA_DEFAULT_RETRY;
|
|||
static int da_default_timeout = DA_DEFAULT_TIMEOUT;
|
||||
static sbintime_t da_default_softtimeout = DA_DEFAULT_SOFTTIMEOUT;
|
||||
static int da_send_ordered = DA_DEFAULT_SEND_ORDERED;
|
||||
static int da_disable_wp_detection = 0;
|
||||
|
||||
static SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0,
|
||||
"CAM Direct Access Disk driver");
|
||||
|
@ -1480,6 +1481,9 @@ SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RWTUN,
|
|||
&da_default_timeout, 0, "Normal I/O timeout (in seconds)");
|
||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, send_ordered, CTLFLAG_RWTUN,
|
||||
&da_send_ordered, 0, "Send Ordered Tags");
|
||||
SYSCTL_INT(_kern_cam_da, OID_AUTO, disable_wp_detection, CTLFLAG_RWTUN,
|
||||
&da_disable_wp_detection, 0,
|
||||
"Disable detection of write-protected disks");
|
||||
|
||||
SYSCTL_PROC(_kern_cam_da, OID_AUTO, default_softtimeout,
|
||||
CTLTYPE_UINT | CTLFLAG_RW, NULL, 0, dasysctlsofttimeout, "I",
|
||||
|
@ -3336,12 +3340,22 @@ dastart(struct cam_periph *periph, union ccb *start_ccb)
|
|||
void *mode_buf;
|
||||
int mode_buf_len;
|
||||
|
||||
if (da_disable_wp_detection) {
|
||||
if ((softc->flags & DA_FLAG_CAN_RC16) != 0)
|
||||
softc->state = DA_STATE_PROBE_RC16;
|
||||
else
|
||||
softc->state = DA_STATE_PROBE_RC;
|
||||
goto skipstate;
|
||||
}
|
||||
mode_buf_len = 192;
|
||||
mode_buf = malloc(mode_buf_len, M_SCSIDA, M_NOWAIT);
|
||||
if (mode_buf == NULL) {
|
||||
xpt_print(periph->path, "Unable to send mode sense - "
|
||||
"malloc failure\n");
|
||||
softc->state = DA_STATE_PROBE_RC;
|
||||
if ((softc->flags & DA_FLAG_CAN_RC16) != 0)
|
||||
softc->state = DA_STATE_PROBE_RC16;
|
||||
else
|
||||
softc->state = DA_STATE_PROBE_RC;
|
||||
goto skipstate;
|
||||
}
|
||||
scsi_mode_sense_len(&start_ccb->csio,
|
||||
|
|
Loading…
Reference in a new issue