svn commit: r342169 - head/sys/cam/scsi
Andriy Gapon
avg at FreeBSD.org
Mon Dec 17 16:01:38 UTC 2018
Author: avg
Date: Mon Dec 17 16:01:37 2018
New Revision: 342169
URL: https://svnweb.freebsd.org/changeset/base/342169
Log:
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 at twc.com>
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D18496
Modified:
head/sys/cam/scsi/scsi_da.c
Modified: head/sys/cam/scsi/scsi_da.c
==============================================================================
--- head/sys/cam/scsi/scsi_da.c Mon Dec 17 16:00:35 2018 (r342168)
+++ head/sys/cam/scsi/scsi_da.c Mon Dec 17 16:01:37 2018 (r342169)
@@ -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, CT
&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 @@ out:
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,
More information about the svn-src-all
mailing list