Commit Graph

1412 Commits

Author SHA1 Message Date
mav
f60999f291 MFC r271309:
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).
2014-10-06 12:35:41 +00:00
mav
5df569ca0a MFC r272040:
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.

Approved by:	re (gjb)
2014-09-27 08:14:15 +00:00
mav
5f1a68aede MFC r271957: Fix read overrun handling, broken by using wrong variable.
Approved by:	re (marius)
2014-09-25 09:12:11 +00:00
mav
9f773a51bb MFC r271949:
Fix UNMAP stuck if the last block descriptor in the list is empty.

Approved by:	re (glebius)
2014-09-25 09:11:01 +00:00
mav
88996dc68a MFC r271794: 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.

Approved by:	re (dephij)
2014-09-21 12:07:22 +00:00
mav
b701075b7b MFC r271702:
Fix tpc_create_token() introduced in r269497 to encode CREATOR LOGICAL
UNIT DESCRIPTOR field as Identification Descriptor CSCD descriptor, not
just as Identification Descriptor.

Approved by:	re (gjb)
2014-09-20 13:48:52 +00:00
mav
9cd8f95281 MFC r271700: Fix typo in defined ROD types in r269497.
Approved by:	re (gjb)
2014-09-20 13:46:16 +00:00
mav
30b741cb6c MFC r271644:
Add quirks to disable READ CAPACITY (16) for PNY USB 3.0 Flash Drives.

Submitted by:	Sean Fagan <sef@ixsystems.com>
Approved by:	re (kib)
2014-09-18 09:21:29 +00:00
trasz
7b29f9e4e1 MFC r271393:
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.

Approved by:	re (kib)
2014-09-15 11:35:14 +00:00
mav
9ea19c975a MFC r271407: 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.

Approved by:	re (delphij)
2014-09-13 17:13:04 +00:00
mav
85a1618ec2 MFC r271362:
Make ctl_port_mask an array to support more then 32 ports.

Overflow reported by Coverity.

CID:		1229894

Approved by:	re (marius)
2014-09-13 17:08:27 +00:00
smh
a7cb473513 MFC r256956:
Improve ZFS N-way mirror read performance by using load and locality
information.

MFC r260713:
Fix ZFS mirror code for handling multiple DVA's

Also make the addition of the d_rotation_rate binary compatible. This allows
storage drivers compiled for 10.0 to work by preserving the ABI for disks.

Approved by:	re (gjb)
Sponsored by:	Multiplay
2014-09-07 21:30:47 +00:00
trasz
0ca40bff6c MFC r270282:
Use proper include paths in kernel iSCSI code.

Sponsored by:	The FreeBSD Foundation
2014-08-31 20:47:10 +00:00
imp
d577d2038d Merge SETAN changes from head:
r270327 | imp | 2014-08-22 07:15:59 -0600 (Fri, 22 Aug 2014) | 6 lines
	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.

	r270249 | imp | 2014-08-20 16:58:12 -0600 (Wed, 20 Aug 2014) | 13 lines
	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).

Sponsored by:	Netflix (the merge and the original work)
2014-08-26 03:45:54 +00:00
mav
7cd0a41fd9 MFC r270176:
Fix lock recursion on LUN shutdown, introduced on r269497.
2014-08-23 07:03:04 +00:00
smh
52df1b5cbb MFC r269974 - Added 4K quirks for Corsair Force GT and Samsung 840 SSDs
Sponsored by:	Multiplay
2014-08-21 22:47:03 +00:00
mav
e13575583f MFC r269631:
Reduce reported additional INQUIRY data length.

sizeof(struct scsi_inquiry_data) of 256 bytes combined with off-by-one
error in the changed code gave total INQUIRY data length above 255 bytes,
that was maximal INQUIRY length in SPC-2.  While SPC-3 increased the
maximal length to 64K, at least sg3_utils are still confused by that.
2014-08-17 18:26:34 +00:00
mav
b70f4cf9fc MFC r269622:
Fix several issues and inconsistencies in UNMAP capabilities reporting.

This makes Windows 2012 to start using UNMAP on our disks.
2014-08-17 18:24:59 +00:00
mav
8fabb08e85 MFC r269587:
Reimplement WRITE USING TOKEN with Block Zero token using WRITE SAME.

On my ZVOL of SSDs that increases speed of zero writing in that way from
1 to 2.5GB/s by reducing CPU overhead.
2014-08-17 18:23:43 +00:00
mav
6f742fb4d6 MFC r269497:
Add support for Windows dialect of EXTENDED COPY command, aka Microsoft ODX.

This allows to avoid extra network traffic when copying files on NTFS iSCSI
disks within one storage host by drag'n'dropping them in Windows Explorer
of Windows 8/2012.  It should also accelerate Hyper-V VM operations, etc.
2014-08-17 18:22:42 +00:00
joerg
3dd442f19d Merge r269353:
Fix breakage introduced by r256843: removing the SA_CCB_WAITING bit
left some of the decisions based on its counterpart, SA_CCB_BUFFER_IO
being random.  As a result, propagation of the residual information
for the SPACE command was broken, so the number of filemarks
encountered during a SPACE operation was miscalculated.  Consequently,
systems relying on properly tracked filemark counters (like Bacula)
fell apart.

The change also removes a switch/case in sadone() which r256843
degraded to a single remaining case label.

PR:		192285
2014-08-08 14:42:03 +00:00
mav
a140fffd57 MFC r269444, r269450:
Plug EXTENDED COPY request data memory leak.
2014-08-05 08:30:38 +00:00
mav
8a8ea3620e MFC r269442:
Fix some bugs in RECEIVE COPY STATUS data.
2014-08-05 08:29:24 +00:00
mav
0c8d93565f MFC r269441:
Add missing comparisons to make list IDs in EXTENDED COPY per-initiator,
as they should be.  Wrap it into a function to not duplicate the code.
2014-08-05 08:28:29 +00:00
mav
c1cec10724 MFC r269123:
Implement separate I/O dispatch method for ZVOLs in "dev" mode.

Unlike disk devices ZVOLs process all requests synchronously.  That makes
impossible sending multiple requests to them from single thread.  From the
other side ZVOLs have real d_read/d_write methods, which unlike d_strategy
can handle uio scatter/gather and have no strict I/O size limitations.

So, if ZVOL in "dev" mode is detected, use of d_read/d_write methods instead
of d_strategy allows to avoid pointless splitting of large requests into
MAXPHYS (128K) sized chunks.
2014-08-02 06:56:00 +00:00
mav
375621a9a5 MFC r268808:
Increase maximal number of SCSI ports in CTL from 32 to 128.

After I gave each iSCSI target its own port, the old limit appeared to be
not so big.  This change almost proportionally increases per-LUN memory
use, but it is still three times better then it was before r268807.
2014-07-30 07:21:30 +00:00
mav
16407addf1 MFC r268807:
Reduce per-LUN memory usage from 18MB to 1.8MB.

CTL never had use for CA support code since SPI has gone, and there is no
even frontends supporting that.  But it still was reserving 256 bytes of
memory per LUN per every possible initiator on every possible port.

Wrap unused code with ifdef's in case somebody ever need it.
2014-07-30 07:20:36 +00:00
mav
dd34ac0859 MFC r268767:
Add support for VMWare dialect of EXTENDED COPY command, aka VAAI Clone.

This allows to clone VMs and move them between LUNs inside one storage
host without generating extra network traffic to the initiator and back,
and without being limited by network bandwidth.

LUNs participating in copy operation should have UNIQUE NAA or EUI IDs set.
For LUNs without these IDs VMWare will use traditional copy operations.

Beware: the above LUN IDs explicitly set to values non-unique from the VM
cluster point of view may cause data corruption if wrong LUN is addressed!

Sponsored by:	iXsystems, Inc.
2014-07-30 07:18:32 +00:00
mav
1c2891173e MFC r268581:
Merge several equal serialization indexes.
2014-07-30 07:16:08 +00:00
mav
9418843a93 MFC r269149:
Fix several cases of NULL dereference when INQUIRY sent to absent LUN.
2014-07-30 07:08:59 +00:00
mav
e6ff5c766b MFC r269122:
Fix infinite loop, when doing WRITE SAME on file-backed LUN.
2014-07-29 07:40:14 +00:00
trasz
24c4578f54 MFC r269088:
Fix ctl(4) kldload failure that manifested like this:

link_elf_obj: symbol icl_pdu_new_bhs undefined

PR:		192031
Submitted by:	Nils Beyer (earlier version)
Sponsored by:	FreeBSD Foundation
2014-07-28 22:25:27 +00:00
mav
7219c9daf2 MFC r269058:
Fix build with QUEUE_MACRO_DEBUG.
2014-07-27 08:02:24 +00:00
imp
0dacc9824c MFC:
>r267118 | imp | 2014-06-05 11:13:42 -0600 (Thu, 05 Jun 2014) | 9 lines
>The code that combines adjacent ranges for BIO_DELETEs to optimize
>trims to the device assumes the list is sorted. Don't apply the
>optimization of not sorting the queue when we have SSDs to the
>delete_queue, since it causes more discard traffic to the drive. While
>one could argue that the higher levels should coalesce the trims,
>that's not done today, so some optimization at this level is needed.
>CR: https://phabric.freebsd.org/D142
2014-07-17 23:05:20 +00:00
imp
ae99afdd7d MFC:
>r268205 | imp | 2014-07-02 23:22:13 -0600 (Wed, 02 Jul 2014) | 9 lines
>Rework the BIO_DELETE code slightly. Always queue the BIO_DELETE
>requests on the trim_queue, even for the CFA ERASE. This allows us, in
>the future, to collapse adjacent requests. Since CFA ERASE is only for
>CF cards, and it is so restrictive in what it can do, the collapse
>code is not presently here. This also brings the ada driver more in
>line with the da driver's treatment of BIO_DELETEs.
2014-07-17 22:58:05 +00:00
mav
2c6230a1ad MFC r268240 (by ken):
Add persistent reservation support to camcontrol(8).

camcontrol(8) now supports a new 'persist' subcommand that allows users to
issue SCSI PERSISTENT RESERVE IN / OUT commands.
2014-07-15 17:26:43 +00:00
mav
c0be426ce6 MFC r268447:
Add LUN options to specify 64-bit EUI and NAA identifiers.
2014-07-15 17:20:40 +00:00
mav
68cf85bc2c MFC r268421:
Remove status setting from datamove() path.  Leave that to other places.
2014-07-15 17:19:43 +00:00
mav
1e9a14c2c4 MFC r268418:
Enable TAS feature: notify initiator if its command was aborted by other.

That should make operation more kind to multi-initiator environment.
Without this, other initiators may find out that something bad happened
to their commands only via command timeout.
2014-07-15 17:18:50 +00:00
mav
05919e7e4c MFC r268387:
Fix task management functions status: task not found is not an error,
while not implemented function is.
2014-07-15 17:17:52 +00:00
mav
870d4a24fe MFC r268364:
Fix "use after free" on port creation error in r268291.
2014-07-15 17:16:58 +00:00
mav
7bd4e3c249 MFC r268363:
Add support for READ FULL STATUS action of PERSISTENT RESERVE IN command.
2014-07-15 17:16:06 +00:00
mav
342f128143 MFC r268362:
Teach ctl_add_initiator() to dynamically allocate IIDs from pool.

If port passed negative IID value, the function will try to allocate IID
from the pool of unused, based on passed wwpn or name arguments.  It does
all its best to make IID unique and persistent across reconnects.

This makes persistent reservation properly work for iSCSI.  Previously,
in case of reconnects, reservation could be unexpectedly lost, or even
migrate between intiators.
2014-07-15 17:14:53 +00:00
mav
14a59860bb MFC r268356, r268357:
When new connection comes in, check whether we already have session from
the same intiator (Name+ISID).  If so -- terminate the old session and let
the new one take its place, as required by iSCSI RFC.
2014-07-15 17:13:49 +00:00
mav
a0bee6cdf5 MFC r268353:
Implement ABORT TASK SET and I_T NEXUS RESET task management functions.

Use the last one to terminate active commands on iSCSI session termination.
Previous code was aborting only commands doing some data moves.
2014-07-15 17:12:37 +00:00
mav
ebf361d529 MFC r268330:
Make gcc happy, init idlen2.
2014-07-15 17:11:42 +00:00
mav
100d0f0aa6 MFC r268328:
Close race in r268291 between port destruction, delayed by sessions
teardown, and new port creation during `service ctld restart`.

Close it by returning iSCSI port internal state, that allows to identify
dying ports, which should not be counted as existing, from really alive.
2014-07-15 17:10:48 +00:00
mav
247c4d2053 MFC r268309:
Add support for SCSI Ports (88h) VPD page.
2014-07-15 17:09:52 +00:00
mav
938fb0a5f5 MFC r268308:
Make REPORT TARGET PORT GROUPS command report realistic data instead of
hardcoded garbage.
2014-07-15 17:09:02 +00:00
mav
6cb3a6ad50 MFC r268307:
Move lun_map() method from command nexus to port.

Previous implementation made impossible to do some things, such as calling
it for ports other then one through which command arrived.
2014-07-15 17:08:04 +00:00