]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/log
FreeBSD/stable/10.git
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

8 years agoMFC r287771: 5695 dmu_sync'ed holes do not retain birth time
mav [Sat, 3 Oct 2015 11:41:27 +0000 (11:41 +0000)]
MFC r287771: 5695 dmu_sync'ed holes do not retain birth time
(userland portion that was not merged in r286677)

Update zdb to also print ltime, type, and level information
for these new style holes. Previously, only the logical birth
time would be printed.

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

8 years agoMFC r287744 (by delphij): Reduce diff against upstream.
mav [Sat, 3 Oct 2015 11:39:39 +0000 (11:39 +0000)]
MFC r287744 (by delphij): Reduce diff against upstream.

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

8 years agoMFC r287706 (by delphij):
mav [Sat, 3 Oct 2015 11:38:10 +0000 (11:38 +0000)]
MFC r287706 (by delphij):
6214 zpools going south

In r286570 (MFV of r277426) an unprotected write to b_flags to
set the compression mode was introduced.  This would open a race
window where data is partially decompressed, modified, checksummed
and written to the pool, resulting in pool corruption due to the
partial decompression.

Prevent this by reintroducing b_compress

illumos/illumos-gate@d4cd038c92c36fd0ae35945831a8fc2975b5272c

Illumos issues:

    6214 zpools going south
    https://www.illumos.org/issues/6214

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

8 years agoMFV r287703, r287705 (by delphij):
mav [Sat, 3 Oct 2015 11:37:00 +0000 (11:37 +0000)]
MFV r287703, r287705 (by delphij):
6091 avl_add doesn't assert on non-debug builds

Use assfail() from libuutil instead of ASSERT() in userland
AVL avl_add.

illumos/illumos-gate@faa2b6be2fc102adf9ed584fc1a667b4ddf50d78

Illumos issues:

    6091 avl_add doesn't assert on non-debug builds
    https://www.illumos.org/issues/6091

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

8 years agoMFC r287702: 5987 zfs prefetch code needs work
mav [Sat, 3 Oct 2015 11:35:18 +0000 (11:35 +0000)]
MFC r287702: 5987 zfs prefetch code needs work

Rewrite the ZFS prefetch code to detect only forward, sequential
streams.

The following kstats have been added:

    kstat.zfs.misc.arcstats.sync_wait_for_async

        How many sync reads have waited for async read
        to complete. (less is better)

    kstat.zfs.misc.arcstats.demand_hit_predictive_prefetch

        How many demand read didn't have to wait for I/O
        because of predictive prefetch.  (more is better)

zfetch kstats have been similified to hits, misses, and max_streams,
with max_streams representing times when we were not able to create
new stream because we already have the maximum number of sequences
for a file.

The sysctl variable/loader tunable vfs.zfs.zfetch.block_cap have been
replaced by vfs.zfs.zfetch.max_distance, which controls maximum bytes
to prefetch per stream.

illumos/illumos-gate@cf6106c8a0d6598b045811f9650d66e07eb332af

Illumos ZFS issues:

    5987 zfs prefetch code needs work
    https://www.illumos.org/issues/5987

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

8 years agoMFC r287335 (by allanjude):
mav [Sat, 3 Oct 2015 11:27:23 +0000 (11:27 +0000)]
MFC r287335 (by allanjude):
Remove duplicate defines introduced in initial ZFS import (r168404)

This change reduces compiler warnings by removing duplicate defines

Line numbers are from r168404 (and r284648)
#define lbolt: lines 384 and 459 (531 and 648) (original was renamed later)
#define lbolt64: lines 385 and 460 (532 and 649) (original was renamed later)
#define gethrestime_sec: lines 390 and 465 (540 and 653)
uint64_t physmem: lines 402 and 463 (561 and 651)

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

8 years agoMFC r287283 (by delphij):
mav [Sat, 3 Oct 2015 11:24:47 +0000 (11:24 +0000)]
MFC r287283 (by delphij):
Fix a buffer overrun which may lead to data corruption, introduced in
r286951 by reinstating changes in r274628.

In l2arc_compress_buf(), we allocate a buffer to stash away the compressed
data in 'cdata', allocated of l2hdr->b_asize bytes.

We then ask zio_compress_data() to compress the buffer, b_l1hdr.b_tmp_cdata,
which is of l2hdr->b_asize bytes, and have the compressed size (or original
size, if compress didn't gain enough) stored in csize.

To pad the buffer to fit the optimal write size, we round up the compressed
size to L2 device's vdev_ashift.

Illumos code rounds up the size by at most SPA_MINBLOCKSIZE.  Because we
know csize <= b_asize, and b_asize is integer multiple of SPA_MINBLOCKSIZE,
we are guaranteed that the rounded up csize would be <= b_asize. However,
this is not necessarily true when we round up to 1 << vdev_ashift, because
it could be larger than SPA_MINBLOCKSIZE.

So, in the worst case scenario, we are overwriting at most

        (1 << vdev_ashift - SPA_MINBLOCKSIZE)

bytes of memory next to the compressed data buffer.

Andriy's original change in r274628 reorganized the code a little bit,
by moving the padding to after we determined that the compression was
beneficial.  At which point, we would check rounded size against the
allocated buffer size, and the buffer overrun would not be possible.

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

8 years agoMFC r287280 (by delphij):
mav [Sat, 3 Oct 2015 11:23:08 +0000 (11:23 +0000)]
MFC r287280 (by delphij):
In r286705 (Illumos 5960/a2cdcdd), a separate thread is created with curproc
as parent.  In the case of a send or receive, the curproc would be the
userland application that issues the ioctl.  This would trigger an assertion
failure introduced in Solaris compatibility shims in r196458 when kernel is
compiled with INVARIANTS.

Fix this by using p0 (proc0 or kernel) as the parent thread when creating
the kernel threads.

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

8 years agoMFC r287103 (by avg): 5692 expose the number of hole blocks in a file
mav [Sat, 3 Oct 2015 11:21:50 +0000 (11:21 +0000)]
MFC r287103 (by avg): 5692 expose the number of hole blocks in a file

FreeBSD porting notes:
- only kernel-side changes are merged
- the new ioctl is not actually implemented yet
- thus, the goal is to synchronize DMU code

illumos/illumos-gate@2bcf0248e992f292c7b814458bcdce2f004925d6

https://www.illumos.org/issues/5692
we would like to expose the number of hole (sparse) blocks in a file.
this can be useful to for example if you want to fill in the holes with
some data; knowing the number of holes in advances allows you to report
progress on hole filling. We could use SEEK_HOLE to do that but it would
be O(n) where n is the number of holes present in the file.

Author: Max Grossman <max.grossman@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Boris Protopopov <bprotopopov@hotmail.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

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

8 years agoMFC r286983 (by avg):
mav [Sat, 3 Oct 2015 11:19:32 +0000 (11:19 +0000)]
MFC r286983 (by avg):
fix a mismerge in r286539 (MFV 286538: 5562 ZFS sa_handle's violate...)

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

8 years agoMFC r286951: Restore part of r274628, reverted at r286776.
mav [Sat, 3 Oct 2015 11:18:30 +0000 (11:18 +0000)]
MFC r286951: Restore part of r274628, reverted at r286776.

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

8 years agoMFC r286776: Remove some random accumulated diff from Illumos.
mav [Sat, 3 Oct 2015 11:17:31 +0000 (11:17 +0000)]
MFC r286776: Remove some random accumulated diff from Illumos.

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

8 years agoMFC r286774: 2618 arc.c mistypes in the comments
mav [Sat, 3 Oct 2015 11:16:42 +0000 (11:16 +0000)]
MFC r286774: 2618 arc.c mistypes in the comments

Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Josef Sipek <jeffpc@josefsipek.net>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Bart Coddens <bart.coddens@gmail.com>

illumos/illumos-gate@fc98fea58e89224f6f13d7fae246d6cb5dfa35ea

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

8 years agoMFC r286770: Fix r286766 build with debug.
mav [Sat, 3 Oct 2015 11:15:49 +0000 (11:15 +0000)]
MFC r286770: Fix r286766 build with debug.

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

8 years agoMFC r286767: Fix minor mismerge sometimes earlier.
mav [Sat, 3 Oct 2015 11:15:01 +0000 (11:15 +0000)]
MFC r286767: Fix minor mismerge sometimes earlier.

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

8 years agoMFC r286766: 5817 change type of arcs_size from uint64_t to refcount_t
mav [Sat, 3 Oct 2015 11:14:05 +0000 (11:14 +0000)]
MFC r286766: 5817 change type of arcs_size from uint64_t to refcount_t

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <paul.dagnelie@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Garrett D'Amore <garrett@damore.org>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@2fd872a734cf486007a8dba532cec52bfb4d40e5

As a way to make it more difficult to introduce bugs into the ARC, and to
make it easier to diagnose issues when bugs do creep in, it would be
beneficial to change the type of the arc_state_t's arcs_size field to be
a refcount_t instead of a uint64_t. This would allow us to make stricter
checks when incrementing and decrementing the value with debugging enabled,
but still fallback to simple, fast atomic operations when debugging is
disabled.

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

8 years agoMFC r286764: 6033 arc_adjust() should search MFU lists for oldest buffer
mav [Sat, 3 Oct 2015 11:13:01 +0000 (11:13 +0000)]
MFC r286764: 6033 arc_adjust() should search MFU lists for oldest buffer
when adjusting MFU size.

illumos/illumos-gate@31c46cf23cd1cf4d66390a983dc5072d7d299ba2

https://www.illumos.org/issues/6033
  When we're looking for the list containing oldest buffer we never
  actually look at the MFU lists even when we try to evict from MFU.
  looks like a copy paste error, the fix is here:

Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Xin Li <delphij@delphij.net>
Reviewed by: Prakash Surya <me@prakashsurya.com>
Approved by: Matthew Ahrens <mahrens@delphix.com>
Author: Alek Pinchuk <alek@nexenta.com>
Obtained from:  illumos

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

8 years agoMFC r286763: 5497 lock contention on arcs_mtx
mav [Sat, 3 Oct 2015 11:11:56 +0000 (11:11 +0000)]
MFC r286763: 5497 lock contention on arcs_mtx

Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Richard Elling <richard.elling@richardelling.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Prakash Surya <prakash.surya@delphix.com>

illumos/illumos-gate@244781f10dcd82684fd8163c016540667842f203

This patch attempts to reduce lock contention on the current arc_state_t
mutexes. These mutexes are used liberally to protect the number of LRU
lists within the ARC (e.g. ARC_mru, ARC_mfu, etc). The granularity at
which these locks are acquired has been shown to greatly affect the
performance of highly concurrent, cached workloads.

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

8 years agoMFC r286762: Revert part of r205231, introducing multiple ARC state locks.
mav [Sat, 3 Oct 2015 11:10:54 +0000 (11:10 +0000)]
MFC r286762: Revert part of r205231, introducing multiple ARC state locks.

This local implementation will be replaced by one from Illumos to reduce
code divergence and make further merges easier.

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

8 years agoFix r288549 build on stable.
mav [Sat, 3 Oct 2015 09:22:21 +0000 (09:22 +0000)]
Fix r288549 build on stable.

For some reason this (odd) code builds on head, but not on stable.

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

8 years agoMFC r286712: 6096 ZFS_SMB_ACL_RENAME needs to cleanup better
mav [Sat, 3 Oct 2015 08:07:21 +0000 (08:07 +0000)]
MFC r286712: 6096 ZFS_SMB_ACL_RENAME needs to cleanup better

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Gordon Ross <gordon.w.ross@gmail.com>
Reviewed by: George Wilson <gwilson@zfsmail.com>
Approved by: Robert Mustacchi <rm@joyent.com>

illumos/illumos-gate@8f5190a540d64d2debee6664bbc740e4c38f5b7f

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

8 years agoMFC r286710:
mav [Sat, 3 Oct 2015 08:06:29 +0000 (08:06 +0000)]
MFC r286710:
6093 zfsctl_shares_lookup should only VN_RELE() on zfs_zget() success

Reviewed by: Gordon Ross <gwr@nexenta.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Dan McDonald <danmcd@omniti.com>

illumos/illumos-gate@0f92170f1ec2737ee5a0e51b5f74093904811452

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

8 years agoMFC r286708: 5959 clean up per-dataset feature count code
mav [Sat, 3 Oct 2015 08:05:33 +0000 (08:05 +0000)]
MFC r286708: 5959 clean up per-dataset feature count code

Reviewed by: Toomas Soome <tsoome@me.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Alex Reece <alex@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Matthew Ahrens <mahrens@delphix.com>

illumos/illumos-gate@ca0cc3918a1789fa839194af2a9245f801a06b1a

A ZFS feature flags (large blocks) tracks its refcounts as the number of
datasets that have ever used the feature. Several features of this type
are planned to be added (new checksum functions). This code should be made
common infrastructure rather than duplicating the code for each feature.

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

8 years agoMFC r286705: 5960 zfs recv should prefetch indirect blocks
mav [Sat, 3 Oct 2015 08:03:36 +0000 (08:03 +0000)]
MFC r286705: 5960 zfs recv should prefetch indirect blocks
5925 zfs receive -o origin=

Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Author: Paul Dagnelie <pcd@delphix.com>

While running 'zfs recv' we noticed that every 128th 8K block required a
read. We were seeing that restore_write() was calling dmu_tx_hold_write()
and the indirect block was not cached. We should prefetch upcoming indirect
blocks to avoid having to go to disk and blocking the restore_write().

Allow an incremental send stream to be received as a clone, even if the
stream does not mark it as a clone.

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

8 years agoMFC r286689: 5981 Deadlock in dmu_objset_find_dp
mav [Sat, 3 Oct 2015 07:59:25 +0000 (07:59 +0000)]
MFC r286689: 5981 Deadlock in dmu_objset_find_dp

illumos/illumos-gate@1d3f896f5469c69c1339890ec3d68e9feddb0343

https://www.illumos.org/issues/5981
  When dmu_objset_find_dp gets called with a read lock held, it fans out
  the work to the task queue. Each task in turn acquires its own read
  lock before calling the callback. If during this process anyone tries
  to a acquire a write lock, it will stall all read lock requests.Thus
  the tasks will never finish, the read lock of the caller will never
  get freed and the write lock never acquired.  deadlock.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Arne Jansen <jansen@webgods.de>

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

8 years agoMFC r286686: 5269 zpool import slow
mav [Sat, 3 Oct 2015 07:58:28 +0000 (07:58 +0000)]
MFC r286686: 5269 zpool import slow

illumos/illumos-gate@12380e1e701fda28c9e9f32d01cafb54af279eb5

https://www.illumos.org/issues/5269
  When importing a pool (at boot or with zpool import) with many
  filesystem, the process can take minutes. It doesn't matter whether
  the pool has been exported cleanly or uncleanly.  The problem is that
  each dataset has its own log chain. On import, all datasets have to be
  checked if there are logs to replay.  The idea is to speed up this
  process by paralellizing it.

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
Author: Arne Jansen <jansen@webgods.de>

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

8 years agoMFC r286683: 5765 add support for estimating send stream size with
mav [Sat, 3 Oct 2015 07:57:32 +0000 (07:57 +0000)]
MFC r286683: 5765 add support for estimating send stream size with
lzc_send_space when source is a bookmark

Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Steven Hartland <killing@multiplay.co.uk>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Albert Lee <trisk@nexenta.com>
Author: Max Grossman <max.grossman@delphix.com>

illumos/illumos-gate@643da460c8ca583e39ce053081754e24087f84c8

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

8 years agoMFC r286677: 5695 dmu_sync'ed holes do not retain birth time
mav [Sat, 3 Oct 2015 07:55:37 +0000 (07:55 +0000)]
MFC r286677: 5695 dmu_sync'ed holes do not retain birth time

illumos/illumos-gate@70163ac57e58ace1c5c94dfbe85dca5a974eff36

https://www.illumos.org/issues/5695
  In dmu_sync_ready(), a hole block pointer will have it's logical size
  explicitly set as it's necessary for replay purposes. To "undo" this,
  dmu_sync_done() will zero out any hole that it finds. This becomes a
  problem when using the "hole_birth" feature, as this will also wipe out
  any birth time that might have happened to be set on the hole.
  ...
  As a fix, the logic to zero out a hole is only applied to old style
  holes with a birth time of zero. Holes created with the "hole_birth"
  feature enabled will have a non-zero birth time, and will be skipped
  (thus preserving the ltime, type, and level information as well).
  In addition, zdb was updated to also print the ltime, type, and level
  information for these new style holes. Previously, only the logical
  birth time would be printed.

Author: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Reviewed by: Bayard Bell <buffer.g.overflow@gmail.com>
Approved by: Dan McDonald <danmcd@omniti.com>

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

8 years agoMFC r286655: Fix set of sign extension bugs in r286625.
mav [Sat, 3 Oct 2015 07:53:56 +0000 (07:53 +0000)]
MFC r286655: Fix set of sign extension bugs in r286625.

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

8 years agoMFC r286647: Fix assertion panic caused by combination of r286598 and TRIM.
mav [Sat, 3 Oct 2015 07:53:08 +0000 (07:53 +0000)]
MFC r286647: Fix assertion panic caused by combination of r286598 and TRIM.

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

8 years agoMFC r286628: Fix r286625 build on i386.
mav [Sat, 3 Oct 2015 07:52:11 +0000 (07:52 +0000)]
MFC r286628: Fix r286625 build on i386.

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