Commit Graph

259 Commits

Author SHA1 Message Date
Alexander Motin
94ab1f3693 Make iSCSI frontend less chatty while waiting for tasks termination.
MFC after:	1 week
2014-11-22 04:40:24 +00:00
Alexander Motin
6f58afed59 Make cfiscsi_offline() synchronous, waiting for connections termination
before return.  This should make ctld restart more clean and predictable.

MFC after:	2 weeks
2014-11-21 18:05:02 +00:00
Alexander Motin
9a3e44f9c5 Close race between cfiscsi_offline() and new connection arrival.
Incoming connection should be either rejected or accepted and terminated.
2014-11-21 15:38:31 +00:00
Alexander Motin
c6ceed4f7a Remove bunch of unused lun variables.
MFC after:	1 week
2014-11-21 11:21:39 +00:00
Alexander Motin
00dfef9e94 Reduce race between LUN destruction and request arrival.
MFC after:	1 week
2014-11-21 11:20:24 +00:00
Alexander Motin
c82bf2659b Log errors for absent LUNs too.
MFC after:	1 week
2014-11-21 08:24:37 +00:00
Alexander Motin
23b30f5600 Partially reconstruct Active/Standby clusting.
In this mode one head is in Active state, supporting all commands, while
another is in Standby state, supporting only minimal LUN discovery subset.

It is still incomplete since Standby state requires reservation support,
which is impossible to do right without having interlink between heads.
But it allows to run some basic experiments.
2014-11-21 06:27:37 +00:00
Edward Tomasz Napierala
9606f9b5c4 Fix typo.
MFC after:	2 weeks
Sponsored by:	The FreeBSD Foundation
2014-11-19 08:59:49 +00:00
Alexander Motin
fb5780def8 Handle PREEMPT AND ABORT service action equal to PREEMPT.
With command serialization used in CTL, there are no other commands to abort
when PREEMPT AND ABORT gets to run, so it is practically equal to PREEMPT.

MFC after:	1 week
2014-11-09 22:43:29 +00:00
Alexander Motin
3f829b0c9c Fix LUN resize broken by r272911 commit.
MFC after:	3 days
2014-11-07 20:42:15 +00:00
Alexander Motin
3275003e03 Synchronize medium rotation rate in legacy Rigid Disk Drive Geometry mode
page with modern Block Device Characteristics VPD page.

MFC after:	1 week
2014-11-07 00:10:07 +00:00
Alexander Motin
c3e7ba3e6d Add to CTL support for logical block provisioning threshold notifications.
For ZVOL-backed LUNs this allows to inform initiators if storage's used or
available spaces get above/below the configured thresholds.

MFC after:	2 weeks
Sponsored by:	iXsystems, Inc.
2014-11-06 00:48:36 +00:00
Alexander Motin
8da05217b3 Fix residual copy/paste in r274080.
MFC after:	1 week
2014-11-04 07:50:20 +00:00
Alexander Motin
3134cce0ad Improve error handling around duplicate lun and port enable.
This fixes kernel panic if port enabled twice and then disabled.

MFC after:	1 week
2014-11-04 07:44:24 +00:00
Edward Tomasz Napierala
d2d52b0013 s/icl_pdu_new_bhs/icl_pdu_new/; no functional changes, just a little
nicer code.

Sponsored by:	The FreeBSD Foundation
2014-11-03 11:15:51 +00:00
Edward Tomasz Napierala
9f19947146 Change the default log level for iSCSI target from 3 to 1. It should
have been 1 from the beginning; not sure how it ended up at 3.

MFC after:	1 month
Sponsored by:	The FreeBSD Foundation
2014-10-31 19:26:12 +00:00
Alexander Motin
4fc18ff9bb Implement better handling for ENOSPC error for both CTL and CAM.
This makes VMWare VAAI Thin Provisioning Stun primitive activate, pausing
the virtual machine, when backing storage (ZFS pool) is getting overflowed.

MFC after:	1 week
Sponsored by:	iXsystems, Inc.
2014-10-29 03:14:29 +00:00
Alexander Motin
f1eaa9ac49 Remove comment obsoleted by r273730.
MFC after:	1 week
2014-10-27 09:30:57 +00:00
Alexander Motin
115dc0c762 Reduce code duplication around Write Exclusive persistent reservation.
While there, allow some more commands to pass persistent reservation.

MFC after:	1 week
2014-10-27 09:26:24 +00:00
Alexander Motin
b491e75b4b Allocate buffer for READ BUFFER/WRITE BUFFER commands on demand.
These commands are rare, but consume additional 256KB RAM per LUN.

MFC after:	1 week
2014-10-26 23:25:42 +00:00
Alexander Motin
ac4bf33203 Fix support for LUN flat space addressing.
MFC after:	1 week
2014-10-26 20:13:46 +00:00
Alexander Motin
fd86d88034 Fix printing non-terminated strings in devlist XML.
MFC after:	1 week
2014-10-26 15:28:07 +00:00
Alexander Motin
6f67ce91ca Add "rpm" and "formfactor" LUN options to match istgt functionality.
MFC after:	1 week
2014-10-26 07:40:37 +00:00
Alexander Motin
78c4829b8b Add support for 12/16-byte EUI and 16-byte NAA IDs.
MFC after:	1 week
2014-10-25 17:07:35 +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
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
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
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
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