Commit Graph

1514 Commits

Author SHA1 Message Date
George V. Neville-Neil
e3a21bd139 Add new quirks for the latest Samsung SSD, model 850.
Submitted by:	sbruno
MFC after:	2 weeks
2014-10-19 16:46:36 +00:00
Alexander Motin
4cc7d0982c Make VPD 80h (Serial Number) transfer length match serial number length.
MFC after:	1 week
2014-10-18 17:11:02 +00:00
Sean Bruno
323e0f6d4c Add 4k quirks for PM853T Samsung SSD
MFC after:	2 weeks
Sponsored by:	Limelight Networks
2014-10-16 20:33:04 +00:00
Davide Italiano
2be111bf7d Follow up to r225617. In order to maximize the re-usability of kernel code
in userland rename in-kernel getenv()/setenv() to kern_setenv()/kern_getenv().
This fixes a namespace collision with libc symbols.

Submitted by:   kmacy
Tested by:      make universe
2014-10-16 18:04:43 +00:00
Alexander Motin
218d5d4be2 Implement more functional CTL debug logging.
Setting bits in kern.cam.ctl.debug allows to log errors, commands and some
commands data respectively.

MFC after:	1 week
2014-10-16 08:42:17 +00:00
Alexander Motin
9a0190c9a1 Remove couple Copan's vendor-specific mode pages.
Those pages are highly system-/hardware-specific, the code is incomplete,
and so they hardly can be useful for anybody else.
2014-10-14 11:28:25 +00:00
Alexander Motin
523f047ea2 Some groundwork for later Informational Exceptions support.
This includes support for:
 - Read-Write Error Recovery mode page;
 - Informational Exceptions Control mode page;
 - Logical Block Provisioning mode page;
 - LOG SENSE command.

No real Informational Exceptions features yet. This is only a placeholder.

Sponsored by:	iXsystems, Inc.
2014-10-14 10:14:14 +00:00
Alexander Motin
ec05088b9c Add LBPERE mode bit definition. 2014-10-14 08:30:02 +00:00
Alexander Motin
09020352fe Don't confuse frontend with zero length data moves, just return immediately.
MFC after:	1 week
2014-10-13 16:15:32 +00:00
Alexander Motin
d70698b372 Add support for READ DEFECT DATA (10/12) commands.
SPC-4 r2 allows to return empty defect list if the list is not supported.
We don't reallu support defect data lists, but this suppresses some errors.

MFC after:	1 week
2014-10-13 14:48:49 +00:00
Alexander Motin
20a28d6cee Report physical block size for file-backed LUNs, using vattr.va_blocksize.
MFC after:	1 week
2014-10-13 11:00:58 +00:00
Alexander Motin
6461dd5c77 Remove stale comments. 2014-10-12 18:57:22 +00:00
Alexander Motin
555e99a3bf Improve and document ctladm portlist subcommand.
Make this subcommand less FC-specific, reporting target and port addresses
in more generic way.  Also make it report list of connected initiators in
unified way, working for both FC and iSCSI, and potentially others.

MFC after:	1 week
2014-10-12 06:55:34 +00:00
Alexander Motin
9045dbb21c Give physical and virtual ports numbers some more meaning. 2014-10-11 17:52:54 +00:00
Alexander Motin
5c8dcc1131 Shorten frontend name. 2014-10-11 12:56:49 +00:00
Alexander Motin
7d9cb4d9ab Filter out duplicate AC_PATH_REGISTERED async events.
Queued async events handling in CAM opened race, that may lead to duplicate
AC_PATH_REGISTERED events delivery during boot.  That was not happening
before r272935 because the driver was initialized later.  After that change
it started create duplicate ports in CTL.
2014-10-11 10:19:37 +00:00
Alexander Motin
dc5362fde9 Mark CTL frontend's CAM driver as CAM_PERIPH_DRV_EARLY.
Target mode operation does not depend on the initiator mode scan process.
This change allows the target driver to attach earlier and receive some
async events (like AC_CONTRACT) that could be lost otherwise.

MFC after:	1 week
2014-10-11 07:49:27 +00:00
Alexander Motin
19720f4113 Make ctld start even if some LUNs are unable to open backing storage.
Such LUNs will be visible to initiators, but return "not ready" status
on media access commands.  If backing storage become available later,
`ctladm modify ...` or `service ctld reload` can trigger its reopen.
2014-10-10 19:41:09 +00:00
Alexander Motin
0ca2fdeca2 Store persistent reservation keys as uint64_t instead of uint8_t[8].
This allows to simplify the code and save 512KB of RAM per LUN (8%)
by removing no longer needed "registered" keys flags.
2014-10-10 12:38:53 +00:00
Alexander Motin
259f12da87 Make iSCSI connection close somewhat less aggressive.
It allows to push out some final data from the send queue to the socket
before its close.  In particular, it increases chances for logout response
to be delivered to the initiator.
2014-10-09 09:12:08 +00:00
Alexander Motin
840a5dd447 Use proper variable when looping through periphs with CAM_PERIPH_FREE.
PR:		194256
Submitted by:	Scott M. Ferris <smferris@gmail.com>
MFC after:	3 days
Sponsored by:	EMC/Isilon Storage Division
2014-10-09 05:53:58 +00:00
Alexander Motin
5396f4d279 Implement software (mode page) and hardware (config) write protection. 2014-10-08 12:24:24 +00:00
Alexander Motin
8a41675372 Add support for WRITE ATOMIC (16) command and report SBC-4 compliance.
Atomic writes are only supported for ZVOLs in "dev" mode.  In other cases
atomicity can not be guarantied and so the command is blocked.
2014-10-08 07:48:36 +00:00
Alexander Motin
204ca472bf Set CAM_SIM_QUEUED flag before calling ctl_queue() to avoid race.
PR:		194128
Submitted by:	Scott M. Ferris <smferris@gmail.com>
MFC after:	3 days
Sponsored by:	EMC/Isilon Storage Division
2014-10-06 14:52:04 +00:00
Alexander Motin
04f10b6c96 Add support for MaxBurstLength and Expected Data transfer Length parameters.
Before this change target could send R2T request for write transfer of any
size, that could violate iSCSI RFC, which allows initiator to limit maximum
R2T size by negotiating MaxBurstLength connection parameter.

Also report an error in case of write underflow, when initiator provides
less data than initiator expects.  Previously in such case our target
sent R2T request for non-existing data, violating the RFC, and confusing
some initiators.  SCSI specs don't explicitly define how write underflows
should be handled and there are different oppinions, but reporting error
is hopefully better then violating iSCSI RFC with unpredictable results.

MFC after:	2 weeks
2014-10-06 12:20:46 +00:00
Alexander Motin
5554eb9bfc Fix length of Extended INQUIRY Data VPD page.
MFC after:	3 days
2014-10-06 07:01:32 +00:00
Alexander Motin
11cca94715 Use REPORT LUNS command for SPC-2 devices with LUN 0 disconnected.
SPC-2 tells REPORT LUNS shall be supported by devices supporting LUNs other
then LUN 0.  If we see LUN 0 disconnected, guess there may be others, and
so REPORT LUNS shall be supported.

MFC after:	1 month
2014-10-02 10:58:52 +00:00
Alexander Motin
b8f810fecd Make disconnected LUN 0 don't remain in half-configured state if there are
no LUNs on SPC-3 target after we tried REPORT LUNS.
2014-10-02 10:39:07 +00:00
Alexander Motin
5832a6aaf9 Restore CAM_QUIRK_NOLUNS check, lost in previous commit.
MFC after:	1 month
2014-10-02 10:02:38 +00:00
Alexander Motin
1d4bc8bce6 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
Alexander Motin
0b060244ab Fix couple issues with ROD tokens content.
MFC after:	3 days
2014-10-01 11:30:20 +00:00
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