Commit Graph

1545 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
Steven Hartland
85c9dd9d89 Prevent overflow issues in timeout processing
Previously, any timeout value for which (timeout * hz) will overflow the
signed integer, will give weird results, since callout(9) routines will
convert negative values of ticks to '1'. For unsigned integer overflow we
will get sufficiently smaller timeout values than expected.

Switch from callout_reset, which requires conversion to int based ticks
to callout_reset_sbt to avoid this.

Also correct isci to correctly resolve ccb timeout.

This was based on the original work done by Eygene Ryabinkin
<rea@freebsd.org> back in 5 Aug 2011 which used a macro to help avoid
the overlow.

Differential Revision:	https://reviews.freebsd.org/D1157
Reviewed by:	mav, davide
MFC after:	1 month
Sponsored by:	Multiplay
2014-11-21 21:01: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
John Baldwin
a92cf726f8 Lock the scsi_low code and the drivers which use it along with other
related cleanups:
- Require each driver to initalize a mutex in the scsi_low_softc that
  is shared with the scsi_low code.  This mutex is used for CAM SIMs,
  timers, and interrupt handlers.
- Replace the osdep function switch with direct calls to the relevant
  CAM functions and direct manipulation of timers via callout(9).
- Collapse the CAM-specific scsi_low_osdep_interface substructure
  directly into scsi_low_softc.
- Use bus_*() instead of bus_space_*().
- Return BUS_PROBE_DEFAULT from probe routines instead of 0.
- No need to zero softcs.
- Pass 0ul and ~0ul instead of 0 and ~0 to bus_alloc_resource().
- Spell "dettach" as "detach".
- Remove unused 'dvname' variables.
- De-spl().

Tested by:	no one
2014-11-20 20:50:05 +00:00
Alexander Motin
68355d6522 Remove residual xpt_release_device() call left after r272406 cleanup.
Excessive release here could trigger use-after-free condition and kernel
panic on LUN 0 disconnect.

MFC after:	1 week
2014-11-20 19:28:42 +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
50d75c5b57 Fix check for vendor-specific peripheral qualifier.
Submitted by:	anton.rang@isilon.com
MFC after:	1 week
2014-11-13 18:15:05 +00:00
Alexander Motin
aec66495b4 Improve CAM's reaction on asymmetric access errors.
MFC after:	1 month
2014-11-12 01:28:28 +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
Steven Hartland
467298f5e3 Fix CF ERASE breakage caused by 268205.
This prevents BIO_DELETE requests getting stuck in the TRIM queue which
results in a panic on shutdown due to outstanding requests.

PR:		194606
Reported by:	Guido Falsi
Reviewed by:	mav
MFC after:	3 days
Sponsored by:	Multiplay
2014-10-26 18:41:01 +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
Hans Petter Selasky
f0188618f2 Fix multiple incorrect SYSCTL arguments in the kernel:
- Wrong integer type was specified.

- Wrong or missing "access" specifier. The "access" specifier
sometimes included the SYSCTL type, which it should not, except for
procedural SYSCTL nodes.

- Logical OR where binary OR was expected.

- Properly assert the "access" argument passed to all SYSCTL macros,
using the CTASSERT macro. This applies to both static- and dynamically
created SYSCTLs.

- Properly assert the the data type for both static and dynamic
SYSCTLs. In the case of static SYSCTLs we only assert that the data
pointed to by the SYSCTL data pointer has the correct size, hence
there is no easy way to assert types in the C language outside a
C-function.

- Rewrote some code which doesn't pass a constant "access" specifier
when creating dynamic SYSCTL nodes, which is now a requirement.

- Updated "EXAMPLES" section in SYSCTL manual page.

MFC after:	3 days
Sponsored by:	Mellanox Technologies
2014-10-21 07:31:21 +00:00
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