freebsd-skq/share
ken 477d3db78f Fix error recovery behavior in the pass(4) driver.
After FreeBSD SVN revision 236814, the pass(4) driver changed from
only doing error recovery when the CAM_PASS_ERR_RECOVER flag was
set on a CCB to sometimes doing error recovery if the passed in
retry count was non-zero.

Error recovery would happen if two conditions were met:

1.  The error recovery action was simply a retry.  (Which is most
    cases.)
2.  The retry_count is non-zero. (Which happened a lot because of
    cut-and-pasted code.)

This explains a bug I noticed in with camcontrol:

# camcontrol tur da34 -v
Unit is ready
# camcontrol reset da34
Reset of 1:172:0 was successful

At this point, there should be a Unit Attention:

# camcontrol tur da34 -v
Unit is ready

No Unit Attention.

Try it again:

# camcontrol reset da34
Reset of 1:172:0 was successful

Now set the retry_count to 0 for the TUR:

# camcontrol tur da34 -v -C 0
Unit is not ready
(pass42:mps1:0:172:0): TEST UNIT READY. CDB: 00 00 00 00 00 00
(pass42:mps1:0:172:0): CAM status: SCSI Status Error
(pass42:mps1:0:172:0): SCSI status: Check Condition
(pass42:mps1:0:172:0): SCSI sense: UNIT ATTENTION asc:29,2 (SCSI bus reset occurred)
(pass42:mps1:0:172:0): Field Replaceable Unit: 2

There is the unit attention. camcontrol(8) has a default
retry_count of 1, in case someone sets the -E flag without
setting -C.

The CAM_PASS_ERR_RECOVER behavior was only broken with the
CAMIOCOMMAND ioctl, which is the synchronous pass(4) API.  It has
worked as intended (error recovery is only done when the flag
is set) in the asynchronous API (CAMIOQUEUE ioctl).

sys/cam/scsi/scsi_pass.c:
	In passsendccb(), when calling cam_periph_runccb(), only
	specify the error routine when CAM_PASS_ERR_RECOVER is set.

share/man/man4/pass.4:
	Document that CAM_PASS_ERR_RECOVER is needed to enable
	error recovery.

Reported by:	Terry Kennedy <TERRY@glaver.org>
PR:		kern/218572
MFC after:	1 week
Sponsored by:	Spectra Logic
2017-05-03 20:59:47 +00:00
..
colldef Readd Big5: some large databases setup are still requiring it. 2017-04-20 18:21:50 +00:00
ctypedef Readd Big5: some large databases setup are still requiring it. 2017-04-20 18:21:50 +00:00
dict
doc share: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:26:40 +00:00
dtrace Remove redefinitions of some kernel types from mbuf.d. 2016-09-03 20:43:59 +00:00
examples Add UEFI support to vmrun.sh 2017-04-13 00:07:39 +00:00
i18n share: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:26:40 +00:00
keys
man Fix error recovery behavior in the pass(4) driver. 2017-05-03 20:59:47 +00:00
me
misc Add myself (wulf) as a src committer with gonzo and bapt as my mentors. 2017-05-03 20:56:34 +00:00
mk revert r313473 (Disable LLD_IS_LD option combinations that fail) 2017-04-30 16:12:23 +00:00
monetdef Readd Big5: some large databases setup are still requiring it. 2017-04-20 18:21:50 +00:00
msgdef Readd Big5: some large databases setup are still requiring it. 2017-04-20 18:21:50 +00:00
numericdef Readd Big5: some large databases setup are still requiring it. 2017-04-20 18:21:50 +00:00
security
sendmail share: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:26:40 +00:00
skel skel: Remove reference to deleted part in previous commit to this file. 2017-01-24 21:07:13 +00:00
snmp
syscons Remove pc98 support completely. 2017-01-28 02:22:15 +00:00
tabset
termcap Revert r314833 until the problem with INSTALL_RSYMLINKS can be found 2017-03-12 00:37:45 +00:00
tests Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installed 2016-05-04 23:20:53 +00:00
timedef Canada adheres to ISO 8601, let's make the locale reflecting that fact 2017-03-19 18:21:35 +00:00
vt Remove pc98 support completely. 2017-01-28 02:22:15 +00:00
zoneinfo share: normalize paths using SRCTOP-relative paths or :H when possible 2017-03-04 11:26:40 +00:00
Makefile Posixify the locales name for variants 2016-07-03 18:21:11 +00:00
Makefile.inc