Commit Graph

1483 Commits

Author SHA1 Message Date
Alexander Motin
3c21968c19 Do not transfer unneeded training zero bytes in INQUIRY response.
It is an addition to r269631.
2014-09-28 11:10:37 +00:00
Alexander Motin
975c8d15c2 Fix page length reported for Block Limits VPD page. 2014-09-27 20:08:34 +00:00
Alexander Motin
8f07b2d523 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
Alexander Motin
eebb09cfe7 Fix ASCQ for "Logical unit not ready, manual intervention required" error. 2014-09-23 17:30:00 +00:00
Alexander Motin
5b5ad15088 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
Alexander Motin
228e6f4296 Fix read overrun handling, broken by using wrong variable.
MFC after:	3 days
2014-09-22 11:35:06 +00:00
Alexander Motin
227b3b9229 Deny ANCHOR flag set without UNMAP flag set in WRITE SAME commands. 2014-09-22 10:46:06 +00:00
Alexander Motin
9a9fbc3dbd Don't try to continue aborted commands if status was not set. 2014-09-22 10:05:36 +00:00
Alexander Motin
4a6d9c740a 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
Alexander Motin
2f872218e7 Simplify legacy reservation handling. Drop it on I_T nexus loss. 2014-09-22 07:59:25 +00:00
Alexander Motin
b0737f1a67 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
Alexander Motin
d69a1908fc Report proper errors codes for unsupported SERVICE ACTION values. 2014-09-22 01:04:27 +00:00
Alexander Motin
2db9b8b5a0 Polish INQUIRY command fields validation. 2014-09-22 00:40:20 +00:00
Alexander Motin
c7a7dbbc0b Allow SUBPAGE CODE field in MODE SENSE commands. 2014-09-21 14:39:31 +00:00
Alexander Motin
810a5a5c08 Fix inverted expression to report block size in mode page block descriptor. 2014-09-19 11:15:30 +00:00
Alexander Motin
fb767c2ba2 Allow more commands to pass persistent reservation according to SPC-4 r37. 2014-09-18 22:22:14 +00:00
Alexander Motin
64c5167c91 Add support for "no Data-Out Buffer" (NDOB) flag of WRITE SAME (16) command. 2014-09-18 21:39:00 +00:00
Alexander Motin
71d8e97e35 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
Bryan Drewery
21cffce593 Correct a comment 2014-09-17 18:59:25 +00:00
Alexander Motin
4ab4d6879c 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
Alexander Motin
13378399d6 Fix typo in defined ROD types in r269497.
MFC after:	3 days
2014-09-17 06:46:37 +00:00
Alexander Motin
cc47e5ee4f 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
Alexander Motin
29611ce906 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
Alexander Motin
959ec2581b 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
Alexander Motin
ab55ae255a 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
Alexander Motin
8e6441d87d 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
Alexander Motin
abafbab15f 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
Alexander Motin
5e5ac52b42 Add support for Extended INQUIRY Data (0x86) VPD page. 2014-09-11 22:40:11 +00:00
Alexander Motin
a005d36245 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
Edward Tomasz Napierala
2c5b89e54b 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
Edward Tomasz Napierala
42c12ebf91 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
Alexander Motin
bfa005503c 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
Alexander Motin
f198b1719a Remove uninitialized and unused variable, reported by Coverity.
CID:		1230015
2014-09-10 07:00:36 +00:00
Alexander Motin
436b3d2f5a Fix array overrun, reported by Coverity.
CID:		1229970
2014-09-10 06:56:45 +00:00
Alexander Motin
0d5de8346a Fix couple off-by-one range check errors, reported by Coverity.
CID:		1007837
2014-09-10 06:35:00 +00:00
Alexander Motin
41ee818335 Fix memory leak on error, reported by Coverity.
CID:		1007773
2014-09-10 06:29:31 +00:00
Alexander Motin
888da1578a Fix minor buffer overflow reported by Coverity.
CID:		1006781
2014-09-10 06:25:18 +00:00
Alexander Motin
4f3fe448f5 Report that DPO and FUA bits are supported after r271311. 2014-09-09 15:19:38 +00:00
Alexander Motin
a3c5994cdf Oops, missed piece of r271311. 2014-09-09 14:20:55 +00:00
Alexander Motin
c97f969b95 Add support for Mode Page Policy (0x87) VPD page. 2014-09-09 14:09:51 +00:00
Alexander Motin
55551d0542 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
Warner Losh
2da8d262e0 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
Warner Losh
e4bed0b403 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
Sean Bruno
5f91863a54 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
Edward Tomasz Napierala
ddc5fd903d 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
Warner Losh
15f48aaad6 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
John Baldwin
cef60f1868 Unexpand TAILQ_FOREACH(). 2014-08-20 16:07:56 +00:00
Alexander Motin
2ac1d5afc8 Fix lock recursion on LUN shutdown, introduced on r269497.
MFC after:	3 days
2014-08-19 17:04:18 +00:00
Steven Hartland
dc98c62f89 Added 4K quirks for Corsair Force GT and Samsung 840 SSDs
MFC after:	1 week
Sponsored by:	Multiplay
2014-08-14 13:57:17 +00:00
Warner Losh
b7cdc564ac is_full_id is set to 0 and then not used. remove it. 2014-08-08 11:46:45 +00:00