]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
8 years agoMFC r288067: Log iSCSI session reinstatements.
mav [Mon, 5 Oct 2015 10:50:35 +0000 (10:50 +0000)]
MFC r288067: Log iSCSI session reinstatements.

False session reinstatements can be result of misconfiguration, when
several initiators use the same initiator name and ISID.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288786 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288061: Make cltd ignore HA ports.
mav [Mon, 5 Oct 2015 10:49:47 +0000 (10:49 +0000)]
MFC r288061: Make cltd ignore HA ports.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288785 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288059: Bunch of improvements to ctlstat.
mav [Mon, 5 Oct 2015 10:49:01 +0000 (10:49 +0000)]
MFC r288059: Bunch of improvements to ctlstat.

Add -p option to allow filtering by ports.
Make -l and -p options work in all modes as filters.
Improve output formatting to better fit columns.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288784 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288043:
mav [Mon, 5 Oct 2015 10:48:14 +0000 (10:48 +0000)]
MFC r288043:
Output times as normal microseconds, rather then in bintime format.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288783 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288021: Mark with DMA flag I/Os waiting for iSCSI write data after R2T.
mav [Mon, 5 Oct 2015 10:47:18 +0000 (10:47 +0000)]
MFC r288021: Mark with DMA flag I/Os waiting for iSCSI write data after R2T.

Reads and immediate writes are not blocking, so don't bother.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288782 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288020: Remove couple excess SGLIST I/O flags.
mav [Mon, 5 Oct 2015 10:46:24 +0000 (10:46 +0000)]
MFC r288020: Remove couple excess SGLIST I/O flags.

Those flags duplicated respective (sg_entries > 0) values.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288781 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287994: Always execute REPORT LUNS and REQUEST SENSE commands locally.
mav [Mon, 5 Oct 2015 10:45:33 +0000 (10:45 +0000)]
MFC r287994: Always execute REPORT LUNS and REQUEST SENSE commands locally.

REPORT LUNS command is more related to target rather then specific LUN.
This node may be primary for LUNs for some reason unknown to another,
and command forwarded to another node won't be able to report them.

REQUEST SENSE is related to LUN, but in our implementation it reports
only UAs and CAs, that are stored locally rather then on primary node.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288779 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287993: Split two command flags with different meaning.
mav [Mon, 5 Oct 2015 10:44:36 +0000 (10:44 +0000)]
MFC r287993: Split two command flags with different meaning.

This is only a cosmetical change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288778 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287991: Pack struct ctl_ha_msg_hdr by 8 bytes.
mav [Mon, 5 Oct 2015 10:43:45 +0000 (10:43 +0000)]
MFC r287991: Pack struct ctl_ha_msg_hdr by 8 bytes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288777 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287986: Fix memory corruption when >128K transferred through HA link.
mav [Mon, 5 Oct 2015 10:42:58 +0000 (10:42 +0000)]
MFC r287986: Fix memory corruption when >128K transferred through HA link.

While there, do some cleaning.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288776 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287968: Mark I/Os with DMA flag while moving data through the HA link.
mav [Mon, 5 Oct 2015 10:42:07 +0000 (10:42 +0000)]
MFC r287968: Mark I/Os with DMA flag while moving data through the HA link.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288775 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287967: Relax serseq option operation for reads.
mav [Mon, 5 Oct 2015 10:41:08 +0000 (10:41 +0000)]
MFC r287967: Relax serseq option operation for reads.

Previously, with serseq enabled, next command was unblocked only after
previous completed.  With this change, for read operations, next command
is unblocked as soon as last media read completed.  This is important
for frontends that actually wait for data move completion (like camtgt),
or when data are moved through the HA link, or especially when both.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288774 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287957: Kill HA link and shutdown the threads on shutdown.
mav [Mon, 5 Oct 2015 10:40:15 +0000 (10:40 +0000)]
MFC r287957: Kill HA link and shutdown the threads on shutdown.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288773 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287956: Update list of opcodes to 5/26/15.
mav [Mon, 5 Oct 2015 10:39:21 +0000 (10:39 +0000)]
MFC r287956: Update list of opcodes to 5/26/15.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288772 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287955: Update list of ASC/ASCQ codes from 5/20/12 to 8/12/15.
mav [Mon, 5 Oct 2015 10:38:32 +0000 (10:38 +0000)]
MFC r287955: Update list of ASC/ASCQ codes from 5/20/12 to 8/12/15.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288771 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287940: Replicate initiators WWPNs and names between HA peers.
mav [Mon, 5 Oct 2015 10:37:20 +0000 (10:37 +0000)]
MFC r287940: Replicate initiators WWPNs and names between HA peers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288770 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287933: Replicate port->init_devid to HA peer.
mav [Mon, 5 Oct 2015 10:36:28 +0000 (10:36 +0000)]
MFC r287933: Replicate port->init_devid to HA peer.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288769 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287921: When reporting TPT UA, report which of thresholds was reached.
mav [Mon, 5 Oct 2015 10:35:36 +0000 (10:35 +0000)]
MFC r287921: When reporting TPT UA, report which of thresholds was reached.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288768 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287913: Report number of failed XCOPY segment.
mav [Mon, 5 Oct 2015 10:34:40 +0000 (10:34 +0000)]
MFC r287913: Report number of failed XCOPY segment.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288767 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r279433 (by rstone): Implement asprintf in libkern
mav [Mon, 5 Oct 2015 09:46:23 +0000 (09:46 +0000)]
MFC r279433 (by rstone): Implement asprintf in libkern

git-svn-id: svn://svn.freebsd.org/base/stable/10@288766 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287912: Report proper medium error code for VERIFY commands.
mav [Mon, 5 Oct 2015 09:26:52 +0000 (09:26 +0000)]
MFC r287912: Report proper medium error code for VERIFY commands.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288765 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287875: Fix reading after end of file for file-backed LUNs.
mav [Mon, 5 Oct 2015 09:26:00 +0000 (09:26 +0000)]
MFC r287875: Fix reading after end of file for file-backed LUNs.

If backing file is smaller then the LUN size, we have to explicitly clear
the rest of the buffer to not leak some random data from previous I/Os.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288764 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287868: Make COMPARE AND WRITE report offset of difference.
mav [Mon, 5 Oct 2015 09:25:04 +0000 (09:25 +0000)]
MFC r287868: Make COMPARE AND WRITE report offset of difference.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288763 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287860: Frontends don't need to set errors themselves.
mav [Mon, 5 Oct 2015 09:24:08 +0000 (09:24 +0000)]
MFC r287860: Frontends don't need to set errors themselves.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288762 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287855: Don't flap the HA link if sysctl is reset to the same value.
mav [Mon, 5 Oct 2015 09:23:20 +0000 (09:23 +0000)]
MFC r287855: Don't flap the HA link if sysctl is reset to the same value.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288761 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287823: Add ctl-lun config option for consistency in HA setups.
mav [Mon, 5 Oct 2015 09:22:31 +0000 (09:22 +0000)]
MFC r287823: Add ctl-lun config option for consistency in HA setups.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288760 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287818: Fix completion/error status reporting.
mav [Mon, 5 Oct 2015 09:21:45 +0000 (09:21 +0000)]
MFC r287818: Fix completion/error status reporting.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288759 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287816: Close potential race between datamove and HA failover.
mav [Mon, 5 Oct 2015 09:20:57 +0000 (09:20 +0000)]
MFC r287816: Close potential race between datamove and HA failover.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288758 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287784: Implement data/status aggregation for secondary HA node.
mav [Mon, 5 Oct 2015 09:20:09 +0000 (09:20 +0000)]
MFC r287784: Implement data/status aggregation for secondary HA node.

For short read requests this reduces latency by 30%, reporting command
completion after two interlink roundtrips instead of full three.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288757 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287783: Implement data/status aggregation for camsim backend.
mav [Mon, 5 Oct 2015 09:19:14 +0000 (09:19 +0000)]
MFC r287783: Implement data/status aggregation for camsim backend.

This is almost pointless for primary HA node, but useful for secondary,
where between fe_datamove and fe_done calls goes another link roundtrip.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288756 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287778: Remove CTL_PRIV_LBA_LEN from HA messages.
mav [Mon, 5 Oct 2015 09:18:22 +0000 (09:18 +0000)]
MFC r287778: Remove CTL_PRIV_LBA_LEN from HA messages.

Previously it was used for statistics, but now just a 16 extra bytes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288755 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287774: Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.
mav [Mon, 5 Oct 2015 09:16:55 +0000 (09:16 +0000)]
MFC r287774: Implement QUERY TASK, QUERY TASK SET and QUERY ASYNC EVENT.

Now we support most of SAM-5 task management.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288754 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287766: Add negotiation of iSCSIProtocolLevel to 2 (RFC7144).
mav [Mon, 5 Oct 2015 09:16:01 +0000 (09:16 +0000)]
MFC r287766: Add negotiation of iSCSIProtocolLevel to 2 (RFC7144).

We may need to pass negotiated value to kernel level, but so far it is
not necessary, since it does not use any new features without request.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288753 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287765: Map CLEAR TASK SET and I_T NEXUS RESET for iSCSI.
mav [Mon, 5 Oct 2015 09:15:11 +0000 (09:15 +0000)]
MFC r287765: Map CLEAR TASK SET and I_T NEXUS RESET for iSCSI.

The last should not be called without iSCSIProtocolLevel negotiation.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288752 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287764: Implement iSCSI TARGET COLD RESET task management function.
mav [Mon, 5 Oct 2015 09:14:20 +0000 (09:14 +0000)]
MFC r287764: Implement iSCSI TARGET COLD RESET task management function.

Implement it as CTL_TASK_TARGET_RESET plus termination of all sessions.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288751 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287760: Improve read-only support.
mav [Mon, 5 Oct 2015 09:13:30 +0000 (09:13 +0000)]
MFC r287760: Improve read-only support.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288750 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287758: Reannounce port to HA peer if LUN map changed after online.
mav [Mon, 5 Oct 2015 09:12:38 +0000 (09:12 +0000)]
MFC r287758: Reannounce port to HA peer if LUN map changed after online.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288749 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287757: When updating port, apply only change of LUN map, not whole.
mav [Mon, 5 Oct 2015 09:11:46 +0000 (09:11 +0000)]
MFC r287757: When updating port, apply only change of LUN map, not whole.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288748 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287756:
mav [Mon, 5 Oct 2015 09:10:58 +0000 (09:10 +0000)]
MFC r287756:
Report INQUIRY DATA HAS CHANGED for related LUNs on port on-/offline.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288747 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287754: Report CTL_UA_LUN_CHANGE on LUN map change.
mav [Mon, 5 Oct 2015 09:09:48 +0000 (09:09 +0000)]
MFC r287754: Report CTL_UA_LUN_CHANGE on LUN map change.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288746 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287748: Make TARGET RESET respect LUN mapping.
mav [Mon, 5 Oct 2015 09:08:58 +0000 (09:08 +0000)]
MFC r287748: Make TARGET RESET respect LUN mapping.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288745 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287724: Check for obsolete NUL bin in CSCD descriptor.
mav [Mon, 5 Oct 2015 09:08:06 +0000 (09:08 +0000)]
MFC r287724: Check for obsolete NUL bin in CSCD descriptor.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288744 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287721: Add HA support for CTL_TASK_I_T_NEXUS_RESET.
mav [Mon, 5 Oct 2015 09:07:15 +0000 (09:07 +0000)]
MFC r287721: Add HA support for CTL_TASK_I_T_NEXUS_RESET.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288743 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287720: Fix false CTL_UA_RES_RELEASE on secondary HA node.
mav [Mon, 5 Oct 2015 09:06:18 +0000 (09:06 +0000)]
MFC r287720: Fix false CTL_UA_RES_RELEASE on secondary HA node.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288742 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287718: Decode WRITE ATOMIC(16) command.
mav [Mon, 5 Oct 2015 09:05:23 +0000 (09:05 +0000)]
MFC r287718: Decode WRITE ATOMIC(16) command.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288741 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287715: Improve XCOPY error reporting.
mav [Mon, 5 Oct 2015 09:04:36 +0000 (09:04 +0000)]
MFC r287715: Improve XCOPY error reporting.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288740 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287714: Report that we have no limit on POPULATE TOKEN segment size.
mav [Mon, 5 Oct 2015 09:03:50 +0000 (09:03 +0000)]
MFC r287714: Report that we have no limit on POPULATE TOKEN segment size.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288739 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287712: Correct RTPG bitmask.
mav [Mon, 5 Oct 2015 09:03:00 +0000 (09:03 +0000)]
MFC r287712: Correct RTPG bitmask.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288738 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287711: Some HA polishing.
mav [Mon, 5 Oct 2015 09:02:13 +0000 (09:02 +0000)]
MFC r287711: Some HA polishing.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288737 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287707: CTL documentation update, mostly for HA.
mav [Mon, 5 Oct 2015 09:01:19 +0000 (09:01 +0000)]
MFC r287707: CTL documentation update, mostly for HA.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288736 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287671:
mav [Mon, 5 Oct 2015 09:00:09 +0000 (09:00 +0000)]
MFC r287671:
Make ctld restart on primary HA node less invasive for secondary.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288735 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287670: Close races between device close and request processing.
mav [Mon, 5 Oct 2015 08:59:18 +0000 (08:59 +0000)]
MFC r287670: Close races between device close and request processing.

All requests arriving for processing after OFFLINE flag set are rejected
with BUSY status.  Races around OFFLINE flag setting are closed by calling
taskqueue_drain_all().

git-svn-id: svn://svn.freebsd.org/base/stable/10@288734 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287664: Reference/release devices on every I/O, rather on open/close.
mav [Mon, 5 Oct 2015 08:58:25 +0000 (08:58 +0000)]
MFC r287664: Reference/release devices on every I/O, rather on open/close.

While this may be slower, it allows device destruction to complete,
rather then block waiting for indefinitely long time.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288733 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287621: Reimplement CTL High Availability.
mav [Mon, 5 Oct 2015 08:57:16 +0000 (08:57 +0000)]
MFC r287621: Reimplement CTL High Availability.

CTL HA functionality was originally implemented by Copan many years ago,
but large part of the sources was never published.  This change includes
clean room implementation of the missing code and fixes for many bugs.

This code supports dual-node HA with ALUA in four modes:
 - Active/Unavailable without interlink between nodes;
 - Active/Standby with second node handling only basic LUN discovery and
reservation, synchronizing with the first node through the interlink;
 - Active/Active with both nodes processing commands and accessing the
backing storage, synchronizing with the first node through the interlink;
 - Active/Active with second node working as proxy, transfering all
commands to the first node for execution through the interlink.

Unlike original Copan's implementation, depending on specific hardware,
this code uses simple custom TCP-based protocol for interlink.  It has
no authentication, so it should never be enabled on public interfaces.

The code may still need some polishing, but generally it is functional.

Relnotes:       yes
Sponsored by:   iXsystems, Inc.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288732 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287620: Remove unused target and initiator IDs.
mav [Mon, 5 Oct 2015 08:55:59 +0000 (08:55 +0000)]
MFC r287620: Remove unused target and initiator IDs.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288731 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287618: Disable CTL_IO_DELAY feature.
mav [Mon, 5 Oct 2015 08:55:00 +0000 (08:55 +0000)]
MFC r287618: Disable CTL_IO_DELAY feature.

It is too developer-oriented to be enabled by default.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288730 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287534: Add two new portal group options "tag" and "foreign".
mav [Mon, 5 Oct 2015 08:54:02 +0000 (08:54 +0000)]
MFC r287534: Add two new portal group options "tag" and "foreign".

They are going to be useful in clustered setups.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288729 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.
mav [Mon, 5 Oct 2015 08:52:37 +0000 (08:52 +0000)]
MFC r287500: Allow LUN options modification via CTL_LUNREQ_MODIFY.

Not all changes take effect, but that is a different question.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288728 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287499: Move setting of media parameters inside open routines.
mav [Mon, 5 Oct 2015 08:51:20 +0000 (08:51 +0000)]
MFC r287499: Move setting of media parameters inside open routines.

This is preparation for possibility to open/close media several times
per LUN life cycle.  While there, rename variables to reduce confusion.
As additional bonus this allows to open read-only media, such as ZFS
snapshots.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288727 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287455, r287458, r287459: Remove some dead code.
mav [Mon, 5 Oct 2015 08:50:15 +0000 (08:50 +0000)]
MFC r287455, r287458, r287459: Remove some dead code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288726 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287433: Small UA cleanup.
mav [Mon, 5 Oct 2015 08:48:47 +0000 (08:48 +0000)]
MFC r287433: Small UA cleanup.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288725 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287372:
mav [Mon, 5 Oct 2015 08:47:45 +0000 (08:47 +0000)]
MFC r287372:
Make most of port methods optional and remove bunch of dummies.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288724 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.
mav [Mon, 5 Oct 2015 08:46:48 +0000 (08:46 +0000)]
MFC r287293: Remove 600 bytes of port_priv from struct ctl_io_hdr.

This field used only for camtgt frontend, and once it any way preallocates
all requests, let it preallocate this memory too, not bothering core code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288723 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287221: Fix type bug introduced at r286811.
mav [Mon, 5 Oct 2015 08:45:56 +0000 (08:45 +0000)]
MFC r287221: Fix type bug introduced at r286811.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288722 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286811: Polish sizes processing.
mav [Mon, 5 Oct 2015 08:44:39 +0000 (08:44 +0000)]
MFC r286811: Polish sizes processing.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288721 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286807: Move "ioctl" CAM frontend into separate file.
mav [Mon, 5 Oct 2015 08:43:47 +0000 (08:43 +0000)]
MFC r286807: Move "ioctl" CAM frontend into separate file.

It has nothing to share with too huge ctl.c other then device descriptor,
but even that may be counted as design error that may be fixed later.
At some point we may even want to have several ioctl ports.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288720 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286806: Drop "internal" CTL frontend.
mav [Mon, 5 Oct 2015 08:42:43 +0000 (08:42 +0000)]
MFC r286806: Drop "internal" CTL frontend.

Its idea was to be a simple initiator and execute several commands from
kernel level, but FreeBSD never had consumer for that functionality,
while its implementation polluted many unrelated places.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288719 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r286406, r286414:
mav [Mon, 5 Oct 2015 08:41:32 +0000 (08:41 +0000)]
MFC r286406, r286414:
Wrap some unused functions with notyet, it is necessary to be able to
build the modules/ctl directly.
Remove a dead MALLOC_DEFINE.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288718 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285600: MULTI_ID supported does not mean it is used.
mav [Mon, 5 Oct 2015 08:35:48 +0000 (08:35 +0000)]
MFC r285600: MULTI_ID supported does not mean it is used.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288717 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285510:
mav [Mon, 5 Oct 2015 08:33:41 +0000 (08:33 +0000)]
MFC r285510:
Switch initiator IDs in target mode to the same address space as target
IDs in initiator mode -- index in port database instead of handlers.

This makes initiator IDs persist across role changes and firmware resets,
when handlers previously assigned by firmware are lost and reused.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288716 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285481: Make role sysctl handling from r284727 less strict.
mav [Mon, 5 Oct 2015 08:32:34 +0000 (08:32 +0000)]
MFC r285481: Make role sysctl handling from r284727 less strict.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288715 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285459: Unify port database use for target and initiator roles.
mav [Mon, 5 Oct 2015 08:31:48 +0000 (08:31 +0000)]
MFC r285459: Unify port database use for target and initiator roles.

Aside from cleaner and more consistent code, this allows ports to be both
target and initiator same time, and easily switch from any role to any.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288714 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285155:
mav [Mon, 5 Oct 2015 08:30:49 +0000 (08:30 +0000)]
MFC r285155:
Make first step toward supporting target and initiator roles same time.

To avoid conflicts between target and initiator devices in CAM, make
CTL use target ID reported by HBA as its initiator_id in XPT_PATH_INQ.
That target ID is known to never be used for initiator role, so it won't
conflict.  For Fibre Channel and FireWire HBAs this specific ID choice
is irrelevant since all target IDs there are virtual. Same time for SPI
HBAs it seems could be even requirement to use same target ID for both
initiator and target roles.

While there are some more things to polish in isp(4) driver, first tests
of using both roles same time on the same port appeared successfull:

# camcontrol devlist -v
scbus0 on isp0 bus 0:
<FREEBSD CTLDISK 0001>             at scbus0 target 1 lun 0 (da20,pass21)
<>                                 at scbus0 target 256 lun 0 (ctl0)
<>                                 at scbus0 target -1 lun ffffffff (ctl1)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288713 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285154: Remove extra level of target ID indirection (isp_dev_map).
mav [Mon, 5 Oct 2015 08:29:31 +0000 (08:29 +0000)]
MFC r285154: Remove extra level of target ID indirection (isp_dev_map).

FreeBSD never had limitation on number of target IDs, and there is no
any other requirement to allocate them densely.  Since slots of port
database already populated just sequentially, there is no much need
for another indirection to allocate sequentially too.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288712 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285147: Change comment added in r284540.
mav [Mon, 5 Oct 2015 08:28:33 +0000 (08:28 +0000)]
MFC r285147: Change comment added in r284540.

This appeared to be not card's issue, but driver's, though solution is
the same so far.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288711 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC 287473,287485,287493,287494
bapt [Mon, 5 Oct 2015 08:18:31 +0000 (08:18 +0000)]
MFC 287473,287485,287493,287494

Add a new sesutil(8) utility

This is an utility for managing SCSI Enclosure Services (SES) device.

For now only one command is supported "locate" which will change the test of the
external LED associated to a given disk.

Usage if the following:
sesutil locate disk [on|off]

Disk can be a device name: "da12" or a special keyword: "all".

Reviewed by: mav
Relnotes: yes
Sponsored by: gandi.net

git-svn-id: svn://svn.freebsd.org/base/stable/10@288710 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285146: Drop discovered targets when initiator role is disabled.
mav [Mon, 5 Oct 2015 08:16:10 +0000 (08:16 +0000)]
MFC r285146: Drop discovered targets when initiator role is disabled.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288709 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r273051 (by imp):
mav [Mon, 5 Oct 2015 08:14:27 +0000 (08:14 +0000)]
MFC r273051 (by imp):
Use the C99 flexible array construct to denote a variable amount of
data rather than the old-school [1] construct. We have required c99
compilers for some time.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288708 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r271731 (by will): Fix a kernel panic when unloading isp(4).
mav [Mon, 5 Oct 2015 08:13:29 +0000 (08:13 +0000)]
MFC r271731 (by will): Fix a kernel panic when unloading isp(4).

In the current implementation, the isp_kthread() threads never exit.

The target threads do have an exit mode from isp_attach(), but it is
not invoked from isp_detach().

Ensure isp_detach() notifies threads started for each channel, such
that they exit before their parent device softc detaches, and thus
before the module does.  Otherwise, a page fault panic occurs later in:

sysctl_kern_proc
  sysctl_out_proc
    kern_proc_out
      fill_kinfo_proc
        fill_kinfo_thread
          strlcpy(kp->ki_wmesg, td->td_wmesg, sizeof(kp->ki_wmesg));

For isp_kthread() (and isp(4) target threads), td->td_wmesg references
now-unmapped memory after the module has been unloaded.  These threads
are typically msleep()ing at the time of unload, but they could also
attempt to execute now-unmapped code segments.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288707 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r285030: Fix couple panics on forced unmount of backing file.
mav [Mon, 5 Oct 2015 08:09:34 +0000 (08:09 +0000)]
MFC r285030: Fix couple panics on forced unmount of backing file.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288706 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r281532 (by delphij): Eliminate unused headers.
mav [Mon, 5 Oct 2015 07:42:05 +0000 (07:42 +0000)]
MFC r281532 (by delphij): Eliminate unused headers.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288704 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r281531 (by asomers):
mav [Mon, 5 Oct 2015 07:40:18 +0000 (07:40 +0000)]
MFC r281531 (by asomers):
Initialize async_arg_ptr in xpt_async when called with async_code
AC_ADVINFO_CHANGED.

Without this change, newly inserted hard disks won't always have their
physical path device nodes created.  The problem reproduces most readily
when attaching a large number of disks at once.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288702 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r280845 (by eadler):
mav [Mon, 5 Oct 2015 07:38:22 +0000 (07:38 +0000)]
MFC r280845 (by eadler):
Add some additional quirks for various Western Digital Caviar MHDDs

git-svn-id: svn://svn.freebsd.org/base/stable/10@288701 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r280388 (by benno): Be consistent with M_ZERO when allocating ccbs.
mav [Mon, 5 Oct 2015 07:36:16 +0000 (07:36 +0000)]
MFC r280388 (by benno): Be consistent with M_ZERO when allocating ccbs.

There are four places, all in cam_xpt.c, where ccbs are malloc'ed. Two of
these use M_ZERO, two don't. The two that don't meant that allocated ccbs
had trash in them making it hard to debug errors where they showed up. Due
to this, use M_ZERO all the time when allocating ccbs.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288700 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r279314 (by trasz): Add missing error check.
mav [Mon, 5 Oct 2015 07:33:54 +0000 (07:33 +0000)]
MFC r279314 (by trasz): Add missing error check.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288699 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r278622 (by trasz): Remove unused code.
mav [Mon, 5 Oct 2015 07:31:51 +0000 (07:31 +0000)]
MFC r278622 (by trasz): Remove unused code.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288698 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r278398 (by trasz):
mav [Mon, 5 Oct 2015 07:29:26 +0000 (07:29 +0000)]
MFC r278398 (by trasz):
Fix ordering of "*logout" and "*terminate"; no functional changes.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288697 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r257831 (by smh):
mav [Mon, 5 Oct 2015 07:21:26 +0000 (07:21 +0000)]
MFC r257831 (by smh):
Corrected definition for old_rate to match d_rotation_rate

git-svn-id: svn://svn.freebsd.org/base/stable/10@288696 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r277440 (by will):
mav [Mon, 5 Oct 2015 07:10:09 +0000 (07:10 +0000)]
MFC r277440 (by will):
Restore the CAM XPT peripheral generation counter, and export it via sysctl.

Define it as an atomic uint32_t.  These increments happen infrequently
enough for the atomic overhead to be a problem, and since they're now
independent atomics, they won't contend with xpt_lock_buses().

This counter is useful as a means of cheaply identifying whether any changes
have been made to the CAM peripheral list.  Userland programs have no guarantee
that the counter won't change on them while being returned or while processing
the information, so they must be written accordingly.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288695 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r277101 (by imp):
mav [Mon, 5 Oct 2015 07:07:37 +0000 (07:07 +0000)]
MFC r277101 (by imp):
Explain a bit of tricky code dealing with trims and how it prevents
starvation. These side effects aren't obvious without extremely
careful study, and are important to do just so.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288694 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r270225 (by jhb): Unexpand TAILQ_FOREACH().
mav [Mon, 5 Oct 2015 06:56:22 +0000 (06:56 +0000)]
MFC r270225 (by jhb): Unexpand TAILQ_FOREACH().

git-svn-id: svn://svn.freebsd.org/base/stable/10@288693 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r269709 (by imp): is_full_id is set to 0 and then not used. remove it.
mav [Mon, 5 Oct 2015 06:55:26 +0000 (06:55 +0000)]
MFC r269709 (by imp): is_full_id is set to 0 and then not used. remove it.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288692 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288068:
kib [Mon, 5 Oct 2015 05:33:30 +0000 (05:33 +0000)]
MFC r288068:
Ensure that maxproc does not exceed pid_max, at the time of boot.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288690 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoFix broken build, again.
peter [Mon, 5 Oct 2015 01:25:51 +0000 (01:25 +0000)]
Fix broken build, again.

cddl/contrib/opensolaris/uts/common/fs/zfs/bqueue.c wasn't added to
conf/files in r286705 and was fixed by r286718.  The broken
version was MFCed by r288571.

Forgotten by:  mav (again)

git-svn-id: svn://svn.freebsd.org/base/stable/10@288681 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoPartially revert r288607, stable/10 does not use ncurses_dll.h.in like head
bdrewery [Sat, 3 Oct 2015 18:40:27 +0000 (18:40 +0000)]
Partially revert r288607, stable/10 does not use ncurses_dll.h.in like head
does, so this file should not be in CLEANFILES / .NOPATH.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288624 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287982:
bdrewery [Sat, 3 Oct 2015 16:26:13 +0000 (16:26 +0000)]
MFC r287982:

  Replace afterinstall: hack from r54681 with 'make delete-old' functionality.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288613 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r287981:
bdrewery [Sat, 3 Oct 2015 16:24:20 +0000 (16:24 +0000)]
MFC r287981:

  Replace afterinstall: hack from r111083 with 'make delete-old' functionality.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288611 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r273756,r287980:
bdrewery [Sat, 3 Oct 2015 16:21:53 +0000 (16:21 +0000)]
MFC r273756,r287980:

  r273756:
    only install .pc files when we are not installing 32bit compat libs...
  r287980:
    Replace beforeinstall: handling with FILES.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288610 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288199,r288246:
bdrewery [Sat, 3 Oct 2015 16:01:16 +0000 (16:01 +0000)]
MFC r288199,r288246:

    Add missing CLEANFILES.

git-svn-id: svn://svn.freebsd.org/base/stable/10@288607 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f

8 years agoMFC r288064 (by avg): 6220 memleak in l2arc on debug build
mav [Sat, 3 Oct 2015 11:43:54 +0000 (11:43 +0000)]
MFC r288064 (by avg): 6220 memleak in l2arc on debug build

illumos/illumos-gate/commit/c546f36aa898d913ff77674fb5ff97f15b2e08b4
https://www.illumos.org/issues/6220
  5408 introduced a memleak in l2arc, namely the member b_thawed gets leaked
  when an arc_hdr is realloced from full to l2only.

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Simon Klinkert <simon.klinkert@gmail.com>
Reviewed by: George Wilson <george@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <sensille@gmx.net>

git-svn-id: svn://svn.freebsd.org/base/stable/10@288599 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f