Commit Graph

1486 Commits

Author SHA1 Message Date
mav
b6b8f03057 Restore CAM_QUIRK_NOLUNS check, lost in previous commit.
MFC after:	1 month
2014-10-02 10:02:38 +00:00
mav
2556958c3c Rework the logic of sequential SCSI LUN scanner.
Previous logic was not differentiating disconnected LUNs and absent targets.
That made it to stop scan if LUN 0 was not found for any reason.  That made
problematic, for example, using iSCSI targets declaring SPC-2 compliance and
having no LUN 0 configured.

The new logic continues sequential LUN scan if:
 -- we have more configured LUNs that need recheck;
 -- this LUN is connected and its SCSI version allows more LUNs;
 -- this LUN is disconnected, its SCSI version allows more LUNs and we
    guess they may be connected (we haven't scanned first 8 LUNs yet or
    kern.cam.cam_srch_hi sysctl is set to scan more).

Reported by:	trasz
MFC after:	1 month
2014-10-02 09:42:11 +00:00
mav
b2a100cdc2 Fix couple issues with ROD tokens content.
MFC after:	3 days
2014-10-01 11:30:20 +00:00
mav
f7e6c416bf Do not transfer unneeded training zero bytes in INQUIRY response.
It is an addition to r269631.
2014-09-28 11:10:37 +00:00
mav
16592938e6 Fix page length reported for Block Limits VPD page. 2014-09-27 20:08:34 +00:00
mav
1a79276d79 When reporting some major UNIT ATTENTION condition, like POWER ON OCCURRED
or I_T NEXUS LOSS, clear all minor UAs for the LUN, redundant in this case.

All SAM specifications tell that target MAY do it, but libiscsi initiator
seems require it to be done, terminating connection with error if some more
UAs happen to be reported during iSCSI connection.

MFC after:	3 days
2014-09-23 20:35:48 +00:00
mav
7b701e7e1c Fix ASCQ for "Logical unit not ready, manual intervention required" error. 2014-09-23 17:30:00 +00:00
mav
039c7786f9 Pretend that we support BYTCHK=1 in WRITE AND VERIFY command.
Technically that is not true, but since we don't implement VERIFY there
at all, doing only WRITE part, this is a minor sin.
2014-09-22 12:40:43 +00:00
mav
1eb6a7500b Fix read overrun handling, broken by using wrong variable.
MFC after:	3 days
2014-09-22 11:35:06 +00:00
mav
9e711a15d7 Deny ANCHOR flag set without UNMAP flag set in WRITE SAME commands. 2014-09-22 10:46:06 +00:00
mav
3832b4fbc3 Don't try to continue aborted commands if status was not set. 2014-09-22 10:05:36 +00:00
mav
2e3ecd2f04 Fix UNMAP stuck if the last block descriptor in the list is empty.
MFC after:	3 days
2014-09-22 09:22:58 +00:00
mav
724af6b5c3 Simplify legacy reservation handling. Drop it on I_T nexus loss. 2014-09-22 07:59:25 +00:00
mav
dc04923c48 Don't report unsupported FUA_NV bit set in READ/WRITE commands as error.
While this bit is obsolete in SBC-3, SBC-2 allowed to silently ignore it.
2014-09-22 01:17:48 +00:00
mav
4710a99b86 Report proper errors codes for unsupported SERVICE ACTION values. 2014-09-22 01:04:27 +00:00
mav
75df401e0f Polish INQUIRY command fields validation. 2014-09-22 00:40:20 +00:00
mav
aa335f6556 Allow SUBPAGE CODE field in MODE SENSE commands. 2014-09-21 14:39:31 +00:00
mav
5586a5309c Fix inverted expression to report block size in mode page block descriptor. 2014-09-19 11:15:30 +00:00
mav
2286325b1e Allow more commands to pass persistent reservation according to SPC-4 r37. 2014-09-18 22:22:14 +00:00
mav
0db50d6959 Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command. 2014-09-18 21:39:00 +00:00
mav
03ea8d9f92 When updating device media size use cached cdevsw pointer.
Using pointer from the cdev directly is dangerous since we have no reference
on it, and it may change any time.  That caused panic if device has gone.

While there, report capacity change only if it really changed.

MFC after:	3 days
2014-09-18 17:25:20 +00:00
bdrewery
a8c488eae3 Correct a comment 2014-09-17 18:59:25 +00:00
mav
89e612ca98 Fix tpc_create_token() introduced in r269497 to encode CREATOR LOGICAL UNIT
DESCRIPTOR field as Identification Descriptor CSCD descriptor, not just as
Identification Descriptor.

MFC after:	3 days
2014-09-17 07:08:59 +00:00
mav
bf11079f06 Fix typo in defined ROD types in r269497.
MFC after:	3 days
2014-09-17 06:46:37 +00:00
mav
764d4fbb38 Add quirks to disable READ CAPACITY (16) for PNY USB 3.0 Flash Drives.
Submitted by:	Sean Fagan <sef@ixsystems.com>
MFC after:	3 days
2014-09-15 19:48:27 +00:00
mav
2969b41f65 Always report that we support REPORT TARGET PORT GROUPS command.
Without clustering support we any way have only one group of permanently
active ports, but that gives us one more supported VMWare feature. ;)

Solaris' Comstar also reports it even when only one port is present.
2014-09-14 23:39:13 +00:00
mav
b2cfbc4e0b Update CAM CCB accounting for the new status quo.
devq_openings counter lost its meaning after allocation queues has gone.
held counter is still meaningful, but problematic to update due to separate
locking of CCB allocation and queuing.

To fix that replace devq_openings counter with allocated counter.  held is
now calculated on request as difference between number of allocated, queued
and active CCBs.

MFC after:	1 month
2014-09-14 11:59:49 +00:00
mav
01d0aad798 Implement control over command reordering via options and control mode page.
It allows to bypass range checks between UNMAP and READ/WRITE commands,
which may introduce additional delays while waiting for UNMAP parameters.
READ and WRITE commands are always processed in safe order since their
range checks are almost free.
2014-09-13 10:34:23 +00:00
mav
20d551b720 Add "readcache" and "writecache" LUN options to control default behavior.
Default values are "on".  Disabling requires backend to support IO_DIRECT
and IO_SYNC flags respectively, or some alternatives.
2014-09-13 08:55:22 +00:00
mav
d38ee29868 Implement range checks between UNMAP and READ/WRITE commands.
Before this change UNMAP completely blocked other I/Os while running.
Now it blocks only colliding ones, slowing down others only due to ZFS
locks collisions.

Sponsored by:	iXsystems, Inc.
2014-09-13 07:45:03 +00:00
mav
a132abedb0 Add support for Extended INQUIRY Data (0x86) VPD page. 2014-09-11 22:40:11 +00:00
mav
a3e07f1c6a Extend UNMAP blacklist on all STEC SSD models.
None of existing STEC devices need UNMAP or even support it well, having
many limitations and even hanging sometimes executing those commands.
New devices that may use UNMAP going to be released under HGST name.

MFC after:	3 days
2014-09-10 21:24:15 +00:00
trasz
d8aaa0480a Make sure we handle less than zero timeouts in iSCSI initiator and target
in a reasonable way.

Sponsored by:	The FreeBSD Foundation
2014-09-10 14:04:10 +00:00
trasz
6cacb7cf77 Make it possible to disable NOP-In PDUs by the iSCSI initiator by setting
kern.cam.ctl.iscsi.ping_timeout to 0.  This fixes interoperability with
some initiators that don't properly support NOP-Ins, namely iPXE/gPXE.

Submitted by:	Chen Wen <pokkys@gmail.com>
MFC after:	1 week
Sponsored by:	The FreeBSD Foundation
2014-09-10 13:34:27 +00:00
mav
645f3f53cf Make ctl_port_mask an array to support more then 32 ports.
Overflow reported by Coverity.

CID:		1229894
MFC after:	3 days
2014-09-10 07:16:17 +00:00
mav
20136fb37c Remove uninitialized and unused variable, reported by Coverity.
CID:		1230015
2014-09-10 07:00:36 +00:00
mav
4db7e51eb2 Fix array overrun, reported by Coverity.
CID:		1229970
2014-09-10 06:56:45 +00:00
mav
a209c226c5 Fix couple off-by-one range check errors, reported by Coverity.
CID:		1007837
2014-09-10 06:35:00 +00:00
mav
8633346319 Fix memory leak on error, reported by Coverity.
CID:		1007773
2014-09-10 06:29:31 +00:00
mav
aa30f2d2de Fix minor buffer overflow reported by Coverity.
CID:		1006781
2014-09-10 06:25:18 +00:00
mav
d6b90c0b3c Report that DPO and FUA bits are supported after r271311. 2014-09-09 15:19:38 +00:00
mav
fbe6280d13 Oops, missed piece of r271311. 2014-09-09 14:20:55 +00:00
mav
abf46035ae Add support for Mode Page Policy (0x87) VPD page. 2014-09-09 14:09:51 +00:00
mav
57ec24a023 Improve cache control support, including DPO/FUA flags and the mode page.
At this moment it works only for files and ZVOLs in device mode since BIOs
have no respective respective cache control flags (DPO/FUA).

MFC after:	1 month
Sponsored by:	iXsystems, Inc.
2014-09-09 11:38:29 +00:00
imp
8d965d25be Add a few defines and packet types for SATA 3.2 and FPDMA (First Party
DMA).

Sponsored by: Netflix
2014-08-30 02:13:04 +00:00
imp
44dfc5f335 We should never enter the PROBE_SETAN phase if we're not ATAPI, since
that's ATAPI specific. Instead, skip to PROBE_SET_MULTI instead for
non ATAPI protocols. The prior code incorrectly terminated the probe
with a break, rather than arranging for probedone to get called. This
caused panics or worse on some systems.
2014-08-22 13:15:59 +00:00
sbruno
62d85fb59c Add the Samsung 843T as a 4k enabled drive
Submitted by:	Jason Wolfe <jason@llnw.com>
MFC after:	2 weeks
Sponsored by:	Limelight Networks
2014-08-21 21:05:58 +00:00
trasz
aa773326bf Use proper include paths in kernel iSCSI code.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-08-21 16:08:17 +00:00
imp
0340ee1c6e Turns out that IDENTIFY DEVICE and IDENTIFY PACKET DEVICE return data
that's only mostly similar. Specifically word 78 bits are defined for
IDENTIFY DEVICE as
	5 Supports Hardware Feature Control
while a IDENTIFY PACKET DEVICE defines them as
	5 Asynchronous notification supported
Therefore, only pay attention to bit 5 when we're talking to ATAPI
devices (we don't use the hardware feature control at this time).
Ignore it for ATA devices. Remove kludge that papered over this issue
for Samsung SATA SSDs, since Micron drives also have the bit set and
the error was caused by this bad interpretation of the spec (which is
quite easy to do, since bits aren't normally overlapping like this).
2014-08-20 22:58:12 +00:00
jhb
1671819e3e Unexpand TAILQ_FOREACH(). 2014-08-20 16:07:56 +00:00