1389 Commits

Author SHA1 Message Date
mav
37a9790756 MFC r267637:
Add iSCSI Target Name ID descriptor to VPD 83h.

It shall/should be there according to SPC-4, and istgt also provides it.
2014-07-04 16:10:14 +00:00
mav
8eb696c14e MFC r267610 (by trasz):
Rework session termination in iSCSI target to actually wait
for any outstanding commands to be properly aborted by CTL.
Without it, in some cases (such as files backing the LUNs
stored on failing disk drives), terminating a busy session
would result in panic.
2014-07-04 16:09:09 +00:00
mav
f736ccce13 MFC r267574 (by trasz):
Make cs_terminating a bool; no functional changes.
2014-07-04 16:07:57 +00:00
mav
cfae63c84f MFC r267547, r267551 (by trasz):
Add LUN-associated name to VPD, to make Hyper-V Failover Cluster happy.
2014-07-04 16:06:56 +00:00
mav
526d9691dc MFC r267051:
- Add support for SG_GET_SG_TABLESIZE IOCTL to report that we don't support
scatter/gather lists.
- Return error for still unsupported SG 3.x API read/write calls.
2014-07-04 15:09:56 +00:00
mav
2019810069 MFC r267537:
Add support for VERIFY(10/12/16) and COMPARE AND WRITE SCSI commands.

Make data_submit backends method support not only read and write requests,
but also two new ones: verify and compare.  Verify just checks readability
of the data in specified location without transferring them outside.
Compare reads the specified data and compares them to received data,
returning error if they are different.

VERIFY(10/12/16) commands request either verify or compare from backend,
depending on BYTCHK CDB field.  COMPARE AND WRITE command executed in two
stages: first it requests compare, and then, if succeesed, requests write.
Atomicity of operation is guarantied by CTL request ordering code.

Sponsored by:	iXsystems, Inc.
2014-07-02 10:45:31 +00:00
mav
ada40bacc7 MFC r267519:
Make backends track completion by processed number of sectors instead of
total transfer size.

Commands such as VERIFY or COMPARE AND WRITE may have transfer size not
matching directly to number of sectors.
2014-07-02 10:43:53 +00:00
mav
15c36a3817 MFC r267515:
Remove memcpy() from ctl_private[] accesses.

That union is aligned enough to access data directly.
2014-07-02 10:42:43 +00:00
mav
27197291fa MFC r267514:
Move kern_total_len setting from backend to core code.
2014-07-02 10:41:11 +00:00
mav
cf9ef68328 MFC r267500:
Format Portal Group Tag same as istgt does -- %4.4x instead of %x.

SPC-4 spec tells it should be "two or more hexadecimal digits".
RFC3720 tells it is 16-bit value.
2014-07-02 10:39:45 +00:00
mav
9389599de5 MFC r267499:
Remove custom processing for "file" option.
2014-07-02 10:38:22 +00:00
mav
eeaafb7fba MFC r267496, r267498:
Add "vendor", "product" and "revision" options to control inquiry data.
2014-07-02 10:37:22 +00:00
mav
a615b5284a MFC r267485:
Remove non-functional remnants of control LUN -- 18MB of RAM for nothing.
2014-07-02 10:36:04 +00:00
mav
a7e3ab1dac MFC r267481, r267952:
Implement small KPI to access LUN options instead doing it by hands.
2014-07-02 10:35:06 +00:00
mav
f77bfe41e2 MFC r265323 (by trasz):
Provide better descriptions for 'struct ctl_scsiio' fields; based mostly
on emails from ken@.
2014-07-02 10:32:44 +00:00
mav
9922777340 MFC r267872:
Allow to use iSCSI immediate data by several ctl_datamove() calls.

While for FreeBSD client that is only a minor optimization, VMWare client
doesn't support additional data requests after all data being sent once as
immediate.
2014-07-02 10:20:08 +00:00
mav
927a52fbbf MFC r266981:
Overhaul CAM SG driver IOCTL interfaces.

Make it really work for native FreeBSD programs.  Before this it was broken
for years due to different number of pointer dereferences in Linux and
FreeBSD IOCTL paths, permanently returning errors to FreeBSD programs.
This change breaks the driver FreeBSD IOCTL ABI, making it more strict,
but since it was not working any way -- who bother.

Add shims for 32-bit programs on 64-bit host, translating the argument
of the SG_IO IOCTL for both FreeBSD and Linux ABIs.

With this change I was able to run 32-bit Linux sg3_utils tools and simple
32 and 64-bit FreeBSD test tools on both 32 and 64-bit FreeBSD systems.
2014-07-02 10:16:12 +00:00
marius
27080bb5dd MFC: r267638
Don't denounce peripherals on system shutdown. Together with r267321
(MFCed to stable/10 in r267775), we're now back to the pre-r228483
level of default verbosity. This in turn again typically allows for
reading information that userland might have printed on the screen
before initiating a halt, but still permits to debug potential device
shutdown problems on system shutdown via CAM_DEBUG etc.

Reviewed by:	mav
Sponsored by:	Bally Wulff Games & Entertainment GmbH
2014-06-23 08:32:36 +00:00
mav
afa2d243ef MFC r267429:
Fix some leaks on LUN creation error.
2014-06-22 21:28:05 +00:00
mav
8c42300872 MFC r265159:
Respect MAXIMUM TRANSFER LENGTH field of Block Limits VPD page.

Nobody yet reported disk supporting I/Os less then our MAXPHYS value, but
since we any way have code to read Block Limits VPD page, that is easy.
2014-05-08 07:13:22 +00:00
mav
878513ca7d MFC r265150:
Do not reread SCSI disk VPD pages on every device open.

Instead of rereading VPD pages on every device open, do it only on initial
device probe, and in cases when device reported via UNIT ATTENTIONs that
something has changed.  Capacity is still rereaded on every open because
it is more critical for operation and more probable to change in run time.

On my tests with Intel 530 SSDs on mps(4) HBA this change reduces time
GEOM needs to retaste the device (that includes few open/close cycles)
from ~150ms to ~30ms.
2014-05-08 07:12:06 +00:00
mav
c2e87a8026 MFC r264886:
Remove limits on size of READ/WRITE operations.

Instead of allocating up to 16MB or RAM at once to handle whole I/O,
allocate up to 1MB at a time, but do multiple ctl_datamove() and storage
I/Os if needed.
2014-05-08 07:10:38 +00:00
mav
e2d7108ca8 MFC r264884:
Make CAM target CTL frontend respect SIM I/O size limitations.

If datamove size is bigger then SIM can handle, or it has more segments
then this code can handle -- split it into several CTIO requests.
2014-05-08 07:08:47 +00:00
mav
84e0de396e MFC r264880 (by trasz):
Modify CTL iSCSI frontend to properly handle situations where datamove
routine is called multiple times per SCSI task.
2014-05-08 07:07:51 +00:00
mav
df5d1f3a9b MFC r264834:
Disable UNMAP support for STEC 842 SSDs.

In some unknown cases UNMAP commands make device firmware stuck.
2014-05-08 07:05:19 +00:00
mav
1252c77788 MFC r264407:
Join CTL worker threads into one process for convenience.
Report their idle state as "-".
2014-05-08 07:04:13 +00:00
mav
9f15393e22 MFC r264406:
Report more readable state "-" for idle CAM scan thread.
2014-05-08 07:01:54 +00:00
mav
2d5dc4736b MFC r264274, r264279, r264283, r264296, r264297:
Add support for SCSI UNMAP commands to CTL.

This patch adds support for three new SCSI commands: UNMAP, WRITE SAME(10)
and WRITE SAME(16).  WRITE SAME commands support both normal write mode
and UNMAP flag.  To properly report UNMAP capabilities this patch also adds
support for reporting two new VPD pages: Block limits and Logical Block
Provisioning.

UNMAP support can be enabled per-LUN by adding "-o unmap=on" to `ctladm
create` command line or "option unmap on" to lun sections of /etc/ctl.conf.

At this moment UNMAP supported for ramdisks and device-backed block LUNs.
It was tested to work great with ZFS ZVOLs.  For file-backed LUNs UNMAP
support is unfortunately missing due to absence of respective VFS KPI.

Sponsored by:   iXsystems, Inc
2014-05-08 07:00:45 +00:00
mav
246a5ae3a0 MFC r260509:
Replace several instances of -1 with appropriate CAM_*_WILDCARD and types.

It was equal before r259397, but for good or bad, not any more for LUNs.

This change fixes at least CAM debugging.
2014-05-08 06:55:48 +00:00
trasz
21ec0cf2d0 MFC r264530:
Properly pass the initiator address when running in proxy mode.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:37:55 +00:00
trasz
1abd1411d7 MFC r264527:
Make it possible to interrupt login when running in proxy mode.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:33:56 +00:00
trasz
f2085cbf68 MFC r264526:
Properly identify target portal when running in proxy mode.  While here,
remove CTL_ISCSI_CLOSE, it wasn't used or implemented anyway.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:32:45 +00:00
trasz
f86dc9fb87 MFC r264525:
Add some stuff to make it easier to figure out for the system administrator
whether the ICL_KERNEL_PROXY stuff got compiled in correctly.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:31:25 +00:00
trasz
690b7a7a12 MFC r264524:
Make it possible for the iSCSI target side to operate in both normal
and ICL_KERNEL_PROXY mode, and fix some bit rot so the latter actually
works again.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:29:39 +00:00
trasz
69dfd86371 MFC r263740:
Use a less unusual syntax in debug printfs.

Sponsored by:	The FreeBSD Foundation
2014-05-07 07:25:47 +00:00
trasz
91f13dce9c MFC r264264 by mav@:
Wakeup only one thread of added in r263978i at a time.

This slightly reduces lock congestion between threads.
2014-05-07 07:20:02 +00:00
trasz
339da02d0d MFC r264110:
All the iSCSI sysctls are also tunables; advertise that.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:46:59 +00:00
trasz
4fd7169afe MFC r264024:
Use atomic ops instead of mutexes where appropriate.

Submitted by:	mav@
Sponsored by:	The FreeBSD Foundation
2014-05-07 06:34:03 +00:00
trasz
26ce3cd6c7 MFC r264023:
Instead of "icltx" and "iclrx", use thread names with prefix from upper
layer, so that one can see which side of the stack the threads are for.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:31:45 +00:00
trasz
76ebd34835 MFC r264022:
Get rid of ICL lock; use upper-layer (initiator or target) lock instead.
This avoids extra locking in icl_pdu_queue(); the upper layer needs to call
it while holding its own lock anyway, to avoid sending PDUs out of order.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:29:01 +00:00
trasz
dfa8f3f0a1 MFC r264020:
Remove the homegrown ctl_be_block_io allocator, replacing it with UMA.
There is no performance difference.

Reviewed by:	mav@
Sponsored by:	The FreeBSD Foundation
2014-05-07 06:26:34 +00:00
trasz
2cb2c64704 MFC r263979:
Hide CTL messages about SCSI error responses.  Too many users take
them for actual target errors.  They can be enabled back by setting
kern.cam.ctl.verbose=1, or booting with bootverbose.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:24:46 +00:00
trasz
4ceefd197d MFC r263978:
Make it possible to have multiple CTL worker threads.  Leave the default
of 1 for now.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:22:51 +00:00
trasz
d026d687fc MFC r263811:
Remove ctl_mem_pool.{c,h}.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:20:35 +00:00
trasz
0060724119 MFC r263810:
Rework cfiscsi_datamove_in() to obey expected data transfer length
received from the initiator.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:18:03 +00:00
trasz
6296615c5f MFC r263745:
Target Transfer Tag is opaque; no need to htonl(3) it.

Sponsored by:	The FreeBSD Foundation
2014-05-07 06:14:41 +00:00
mav
f908bd3cc2 MFC r264191:
Report stripe size and offset of the backing device in READ CAPACITY (16)
as physical sector size and offset.
2014-04-21 16:26:24 +00:00
trasz
37c6468863 MFC r262837:
Make reset handling in iSCSI target RFC-compliant.  This fixes some rare
hangs with Open-iSCSI (Linux).

Sponsored by:	The FreeBSD Foundation
2014-04-17 12:41:12 +00:00
mav
71409ea2b1 MFC r264311 (by smh):
Fix build breakage caused by r264295
2014-04-16 15:27:14 +00:00
mav
469b08489b MFC r264307:
Fix three refcounter leaks and lock recursion they covered.
2014-04-16 10:05:35 +00:00