OpenZFS on OS X/zfs 47ca570module/zcommon zprop_common.c

zpool set usage can core dump.

Calling strcmp() with NULL strings is a core on OSX. Double check that
are not empty.

OpenZFS on OS X/spl 344806amodule/spl spl-kmem.c spl-vm_monitor.c

Use OS callbacks to trigger kmem pressure accounting

OpenZFS on OS X/spl 7ea2f56include/vm vm_monitor.h, module/spl spl-vm_monitor.c spl-osx.c

fix header file typos.

Fix header file typos

OpenZFS on OS X/zfs 177253dmodule/zfs arc.c

Update arc.c

Stimulate arc to release some memory on pressure signal from kernel.
DeltaFile
+23-1module/zfs/arc.c
+23-11 files

OpenZFS on OS X/zfs 35dc8cemodule/zfs arc.c

Update arc.c

Experimental branch to explore the use of the newishly provided memory pressure callbacks 
from the kernel.
DeltaFile
+14-0module/zfs/arc.c
+14-01 files

OpenZFS on OS X/spl 343cfe2module/spl/KernelExports zfs.exports

Update zfs.exports

Experimental branch looking into whether _fs_buffer_cache_gc_register, and 
_fs_buffer_cache_gc_unregister do actually provide timely pressure indications out of the 
VM allowing us to free memory in concert with the rest of the OS.

OpenZFS on OS X/zfs 33c3e83tests/zfs-tests/tests/functional/cli_root/zpool_scrub setup.ksh zpool_scrub_003_pos.ksh, tests/zfs-tests/tests/functional/removal removal_reservation.ksh

Fix test/zpool_scrub

Some patch merge markers were present, and additional fixes added.

OpenZFS on OS X/zfs 41175eeman/man5 zpool-features.5

Fix allocation_classes GUID in zpool-features(5)

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Signed-off-by: DHE <git at dehacked.net>

OpenZFS on OS X/zfs 45527a7cmd/zdb zdb.c, cmd/zpool zpool_main.c zpool_vdev.c

Pool allocation classes

Allocation Classes add the ability to have allocation classes in a
pool that are dedicated to serving specific block categories, such
as DDT data, metadata, and small file blocks. A pool can opt-in to
this feature by adding a 'special' or 'dedup' top-level VDEV.

Reviewed by: Pavel Zakharov <pavel.zakharov at delphix.com>
Reviewed-by: Richard Laager <rlaager at wiktel.com>
Reviewed-by: Alek Pinchuk <apinchuk at datto.com>
Reviewed-by: Håkan Johansson <f96hajo at chalmers.se>
Reviewed-by: Andreas Dilger <andreas.dilger at chamcloud.com>
Reviewed-by: DHE <git at dehacked.net>
Reviewed-by: Richard Elling <Richard.Elling at RichardElling.com>
Reviewed-by: Gregor Kopka <gregor at kopka.net>
Reviewed-by: Kash Pande <kash at tripleback.net>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Matthew Ahrens <mahrens at delphix.com>
Signed-off-by: Don Brady <don.brady at delphix.com>

OpenZFS on OS X/zfs 09f330acmd/zpool zpool_main.c

Pass status_cbdata_t to print_status_config() and friends

First rename spare_cbdata_t cb -> spare_cb in print_status_config(),
to free up cb.

Using the structure removes the explicit parameters namewidth
and name_flags from several functions.  Also use status_cbdata_t
for print_import_config().  This simplifies print_logs().

Remove the parameter 'verbose' for print_logs().  It does not really
mean verbose, it selected between the print_status_config and
print_import_config() paths.  This selection is now done by
cb_print_config of spare_cbdata_t.

Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Håkan Johansson <f96hajo at chalmers.se>
DeltaFile
+67-70cmd/zpool/zpool_main.c
+67-701 files

OpenZFS on OS X/zfs 7f046dccmd/zdb zdb.c, include/sys avl.h

Clean up Warnings

OpenZFS on OS X/zfs 4252777config zfs-meta.m4

Merge branch 'master' of github.com:openzfsonosx/zfs
DeltaFile
+1-1config/zfs-meta.m4
+1-11 files

OpenZFS on OS X/zfs 2de364ecmd/zdb zdb.c, cmd/zpool zpool_main.c

Multi-modifier protection (MMP)

Add multihost=on|off pool property to control MMP.  When enabled
a new thread writes uberblocks to the last slot in each label, at a
set frequency, to indicate to other hosts the pool is actively imported.
These uberblocks are the last synced uberblock with an updated
timestamp.  Property defaults to off.

During tryimport, find the "best" uberblock (newest txg and timestamp)
repeatedly, checking for change in the found uberblock.  Include the
results of the activity test in the config returned by tryimport.
These results are reported to user in "zpool import".

Allow the user to control the period between MMP writes, and the
duration of the activity test on import, via a new module parameter
zfs_multihost_interval.  The period is specified in milliseconds.  The
activity test duration is calculated from this value, and from the
mmp_delay in the "best" uberblock found initially.

Add a kstat interface to export statistics about Multiple Modifier
Protection (MMP) updates. Include the last synced txg number, the
timestamp, the delay since the last MMP update, the VDEV GUID, the VDEV
label that received the last MMP update, and the VDEV path.  Abbreviated
output below.


    [447 lines not shown]

OpenZFS on OS X/zfs 061aa13module/zfs vdev_label.c

Correct lock ASSERTs in vdev_label_read/write

The existing assertions in vdev_label_read() and vdev_label_write(),
testing which config locks are held, are incorrect. The assertions
test for locks which exceed what is required for safety.

Both vdev_label_{read,write}() are changed to assert SCL_STATE is held
as RW_READER or RW_WRITER. This is safe because:

Changes to the vdev tree occur under SCL_ALL as RW_WRITER, via
spa_vdev_enter() and spa_vdev_exit().

Changes to vdev state occur under SCL_STATE_ALL as RW_WRITER, via
spa_vdev_state_enter() and spa_vdev_state_exit().

Therefore, the new assertions guarantee that the vdev cannot change
out from under a zio, and I/O to a specified leaf vdev's label is
safe.

Furthermore, this is consistent with the SPA locking discussion in
spa_misc.c, "For any zio operation that takes an explicit vdev_t
argument ... zio_read_phys(), or zio_write_phys() ... SCL_STATE as
reader suffices."

Reviewed-by: Chunwei Chen <david.chen at osnexus.com>

    [3 lines not shown]

OpenZFS on OS X/spl 9fb091econfig spl-meta.m4

fix git hash not showing up in kext_version

git describe only sees annotated tags by default, and as we match the name anyway, we can 
as well drop the requirement of annotation
DeltaFile
+1-1config/spl-meta.m4
+1-11 files

OpenZFS on OS X/zfs 677e3e1config zfs-meta.m4

fix git hash not showing up in kext_version

git describe only sees annotated tags by default, and as we match the name anyway, we can 
as well drop the requirement of annotation
DeltaFile
+1-1config/zfs-meta.m4
+1-11 files

OpenZFS on OS X/zfs a32f459cmd/zpool zpool_main.c, man/man5 zfs-module-parameters.5

Sequential scrub and resilvers

Currently, scrubs and resilvers can take an extremely
long time to complete. This is largely due to the fact
that zfs scans process pools in logical order, as
determined by each block's bookmark. This makes sense
from a simplicity perspective, but blocks in zfs are
often scattered randomly across disks, particularly
due to zfs's copy-on-write mechanisms.

This patch improves performance by splitting scrubs
and resilvers into a metadata scanning phase and an IO
issuing phase. The metadata scan reads through the
structure of the pool and gathers an in-memory queue
of I/Os, sorted by size and offset on disk. The issuing
phase will then issue the scrub I/Os as sequentially as
possible, greatly improving performance.

This patch also updates and cleans up some of the scan
code which has not been updated in several years.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Authored-by: Saso Kiselkov <saso.kiselkov at nexenta.com>
Authored-by: Alek Pinchuk <apinchuk at datto.com>
Authored-by: Tom Caputi <tcaputi at datto.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>

OpenZFS on OS X/zfs 1b1903finclude/sys trace_arc.h zio.h, module/zfs arc.c zio.c

Support re-prioritizing asynchronous prefetches

When sequential scrubs were merged, all calls to arc_read()
(including prefetch IOs) were given ZIO_PRIORITY_ASYNC_READ.
Unfortunately, this behaves badly with an existing issue where
prefetch IOs cannot be re-prioritized after the issue. The
result is that synchronous reads end up in the same vdev_queue
as the scrub IOs and can have (in some workloads) multiple
seconds of latency.

This patch incorporates 2 changes. The first ensures that all
scrub IOs are given ZIO_PRIORITY_SCRUB to allow the vdev_queue
code to differentiate between these I/Os and user prefetches.
Second, this patch introduces zio_change_priority() to provide
the missing capability to upgrade a zio's priority.

Reviewed by: George Wilson <george.wilson at delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tom Caputi <tcaputi at datto.com>

OpenZFS on OS X/zfs 370264cmodule/zfs vdev_queue.c

Fix deadlock in IO pipeline

In vdev_queue_aggregate() the zio_execute() bypass should not be
called under the vdev queue lock.  This can result in a deadlock
as shown in the stack traces below.

Drop the vdev queue lock then walk the parents of the aggregate IO
to determine the list of component IOs to be bypassed.  This can
be done safely without holding the io_lock since the new aggregate
IO has not yet been returned and its parents cannot change.

---  THREAD 1 ---
arc_read()
  zio_nowait()
    zio_vdev_io_start()
      vdev_queue_io() <--- mutex_enter(vq->vq_lock)
        vdev_queue_io_to_issue()
          vdev_queue_aggregate()
            zio_execute()
              zio_vdev_io_assess()
                zio_wait_for_children() <- mutex_enter(zio->io_lock)

--- THREAD 2 --- (inverse order)
arc_read()
  zio_change_priority() <- mutex_enter(zio->zio_lock)

    [5 lines not shown]

OpenZFS on OS X/zfs 868794cmodule/zfs vdev_queue.c

Fix zio->io_priority failed (7 < 6) assert

This fixes an assert in vdev_queue_change_io_priority():

  VERIFY3(zio->io_priority < ZIO_PRIORITY_NUM_QUEUEABLE) failed (7 < 6)
  PANIC at vdev_queue.c:832:vdev_queue_change_io_priority()

Reviewed-by: Tom Caputi <tcaputi at datto.com>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Tony Hutter <hutter2 at llnl.gov>

OpenZFS on OS X/zfs 5ffe3d6module/zfs ldi_iokit.cpp ldi_vnode.c

Release mutex before iokit calls

Due to IOkit call lockForArbitration() and CoreStorage opening zvols
we can deadlock.

OpenZFS on OS X/zfs f5309e6module/zfs ldi_iokit.cpp ldi_vnode.c

Release mutex before iokit calls

OpenZFS on OS X/spl 85a50c6module/spl spl-kmem.c

We must still allow kmem_free(NULL)

Unsure why yet - should probably address this some time in the future

OpenZFS on OS X/spl 45484eamodule/spl spl-kmem.c

Allow kmem_alloc(len == 0)

Previously we would return NULL for zero length allocation requrests but
this invalidates KM_SLEEP. There is no easy way to check flags used at
allocation when we free, so the simplest solution is to now allow
zero length allocations.

Precedent set by ZOL.

OpenZFS on OS X/spl 16b66b0module/spl spl-kmem.c

Refresh memory_leak check code

It gets tricky when wanting to check size 4096 and above.
DeltaFile
+1-11module/spl/spl-kmem.c
+1-111 files

OpenZFS on OS X/zfs 5570d01module/zfs arc.c

Incorrect arc_hdr_size adjustment

Most likely mis-merge
DeltaFile
+0-3module/zfs/arc.c
+0-31 files

OpenZFS on OS X/spl e3c366emodule/spl spl-kmem.c

More verbose progress when memory leak is enabled

OpenZFS on OS X/spl 021f2e4module/spl spl-kmem.c

Memory leak accounting

Allow for a slab-size to be tracked, by growing its allocations to fit
"keep_t" struct, which stores filename and line number, plus, list_node.
Store keep in linked_list, and remove on kmem_free. At kextunload,
dump any elements still in the list.
DeltaFile
+10-1module/spl/spl-kmem.c
+10-11 files

OpenZFS on OS X/spl 43e0bcemodule/spl spl-kmem.c

More verbose progress when memory leak is enabled

OpenZFS on OS X/spl 2254686include/sys kmem.h, module/spl spl-kmem.c

Memory leak accounting

Allow for a slab-size to be tracked, by growing its allocations to fit
"keep_t" struct, which stores filename and line number, plus, list_node.
Store keep in linked_list, and remove on kmem_free. At kextunload,
dump any elements still in the list.

OpenZFS on OS X/spl d770fc4include/osx mutex.h, module/spl spl-kmem.c

Refresh memory_leak check code

It gets tricky when wanting to check size 4096 and above.

OpenZFS on OS X/zfs 80a8bf8lib/libspl/include/sys isa_defs.h, module/icp/algs/modes ccm.c

Fix kernel unaligned access on sparc64

Update the SA_COPY_DATA macro to check if architecture supports
efficient unaligned memory accesses at compile time.  Otherwise
fallback to using the sa_copy_data() function.

The kernel provided CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS is
used to determine availability in kernel space.  In user space
the x86_64, x86, powerpc, and sometimes arm architectures will
define the HAVE_EFFICIENT_UNALIGNED_ACCESS macro.

Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Closes #7642
Closes #7684

OpenZFS on OS X/zfs b7b8e35module/icp Makefile.in, module/icp/asm-x86_64/aes aes_intel.S

Change movaps to movups in AES-NI code

Currently, the ICP contains accelerated assembly code to be
used specifically on CPUs with AES-NI enabled. This code
makes heavy use of the movaps instruction which assumes that
it will be provided aes keys that are 16 byte aligned. This
assumption seems to hold on Illumos, but on Linux some kernel
options such as 'slub_debug=P' will violate it. This patch
changes all instances of this instruction to movups which is
the same except that it can handle unaligned memory.

This patch also adds a few flags which were accidentally never
given to the assembly compiler, resulting in objtool warnings.

Reviewed by: Gvozden Neskovic <neskovic at gmail.com>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Nathaniel R. Lewis <linux.robotdude at gmail.com>
Signed-off-by: Tom Caputi <tcaputi at datto.com>
Closes #7065
Closes #7108

OpenZFS on OS X/zfs 0be3c03include/sys vdev_impl.h ldi_buf.h, module/zfs ldi_iokit.cpp vdev_disk.c

Avoid kmem_alloc in IO path

There appears to be some issues with too-frequent allocations in spl-kmem
and this is especially noticable due to allocations we do for each
read or write IO operation.
We embed the vdev_buf into zio struct itself, and since ldi_vnode has
to call buf_alloc() we also allow ldi_iokit to allocate a local holder.
(It is inconvenient to try to include C++ headers in zio.h).

If this does speed up IO, it is only because we now avoid the real problem
which is still something we should also address

OpenZFS on OS X/zfs 0ea7ad4module/zfs metaslab.c

Correct merge in metaslab
DeltaFile
+10-2module/zfs/metaslab.c
+10-21 files

OpenZFS on OS X/zfs 434b5a6man/man8 zfs.8 zpool.8

Minor corrections to manpages

OpenZFS on OS X/spl c3a671bmodule/spl spl-osx.c

Move all init into delay thread
DeltaFile
+23-19module/spl/spl-osx.c
+23-191 files

OpenZFS on OS X/zfs e2eee22cmd/zpool zpool_main.c, module/zfs metaslab.c vdev.c

Code review changes

OpenZFS on OS X/zfs ecd8379cmd/ztest ztest.c

MMP should not suspend pool in ztest

When running ztest, never suspend the pool due to failed or delayed
MMP writes.

There are many sources of long delays within ztest, such as device
opens, closes, etc. which in combination, may delay MMP writes too
long and cause MMP to suspend the pool.

Some of these delays also affect real pools, and should be fixed.
That is being worked separately.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
DeltaFile
+2-0cmd/ztest/ztest.c
+2-01 files

OpenZFS on OS X/zfs deb91bemodule/zfs mmp.c

Fix divide-by-zero in mmp_delay_update()

vdev_count_leaves() in the denominator may return 0, caught by Coverity.
Introduced by

* 533ea04 Update mmp_delay on sync or skipped, failed write

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: George Melikov <mail at gmelikov.ru>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
DeltaFile
+1-1module/zfs/mmp.c
+1-11 files

OpenZFS on OS X/zfs 85a516emodule/zfs mmp.c spa.c, tests/zfs-tests/tests/functional/mmp mmp.kshlib mmp_active_import.ksh

Update mmp_delay on sync or skipped, failed write

When an MMP write is skipped, or fails, and time since
mts->mmp_last_write is already greater than mts->mmp_delay, increase
mts->mmp_delay.  The original code only updated mts->mmp_delay when a
write succeeded, but this results in the write(s) after delays and
failed write(s) reporting an ub_mmp_delay which is too low.

Update mmp_last_write and mmp_delay if a txg sync was successful.  At
least one uberblock was written, thus extending the time we can be sure
the pool will not be imported by another host.

Do not allow mmp_delay to go below (MSEC2NSEC(zfs_multihost_interval) /
vdev_count_leaves()) so that a period of frequent successful MMP writes,
e.g. due to frequent txg syncs, does not result in an import activity
check so short it is not reliable based on mmp thread writes alone.

Remove unnecessary local variable, start.  We do not use the start time
of the loop iteration.

Add a debug message in spa_activity_check() to allow verification of the
import_delay value and to prove the activity check occurred.

Alter the tests that import pools and attempt to detect an activity
check.  Calculate the expected duration of spa_activity_check() based on

    [9 lines not shown]

OpenZFS on OS X/zfs 6909400cmd/zpool zpool_main.c, include/sys zio.h spa_impl.h

Report pool suspended due to MMP

When the pool is suspended, record whether it was due to an I/O error or
due to MMP writes failing to succeed within the required time.

Change spa_suspended from uint8_t to zio_suspend_reason_t to store the
reason.

When userspace queries pool status via spa_tryimport(), report the
reason the pool was suspended in a new key,
ZPOOL_CONFIG_SUSPENDED_REASON.

In libzfs, when interpreting the returned config nvlist, report
suspension due to MMP with a new pool status enum value,
ZPOOL_STATUS_IO_FAILURE_MMP.

In status_callback(), which generates and emits the message when 'zpool
status' is executed, add a case to print an appropriate message for the
new pool status enum value.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>

OpenZFS on OS X/zfs d9c711dmodule/zfs mmp.c

Fix MMP write frequency for large pools

When a single pool contains more vdevs than the CONFIG_HZ for
for the kernel the mmp thread will not delay properly.  Switch
to using cv_timedwait_sig_hires() to handle higher resolution
delays.

This issue was reported on Arch Linux where HZ defaults to only
100 and this could be fairly easily reproduced with a reasonably
large pool.  Most distribution kernels set CONFIG_HZ=250 or
CONFIG_HZ=1000 and thus are unlikely to be impacted.

Reviewed-by: George Melikov <mail at gmelikov.ru>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Brian Behlendorf <behlendorf1 at llnl.gov>
DeltaFile
+3-3module/zfs/mmp.c
+3-31 files

OpenZFS on OS X/zfs 1f88df2module/zfs mmp.c

Handle zio_resume and mmp => off

When multihost is disabled on a pool, and the pool is resumed via zpool
clear, within a single cycle of the mmp thread's loop (e.g.  while it's
in the cv_timedwait call), both mmp_last_write and mmp_delay should be
updated.

The original code mistakenly treated the two cases as if they could not
occur at the same time.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Tony Hutter <hutter2 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
DeltaFile
+10-4module/zfs/mmp.c
+10-41 files

OpenZFS on OS X/zfs c1e3b2einclude/sys spa.h, module/zfs mmp.c spa_stats.c

Record skipped MMP writes in multihost_history

Once per pass through the MMP thread's loop, the vdev tree is walked to
find a suitable leaf to write the next MMP block to.  If no such leaf is
found, the thread sleeps for a while and resumes at the top of the loop.

Add an entry to multihost_history when no leaf can be found, and record
the reason in the error column.  The error code for such entries is a
bitfield, displayed in hex:

0x1  At least one vdev (interior or leaf) was not writeable.
0x2  At least one writeable leaf vdev was found, but it had a pending
MMP write.

timestamp = the time in seconds since the epoch when no leaf could be
found originally.

duration = the time (in ns) during which no MMP block was written for
this reason.  This does not include the preceeding inter-write period
nor the following inter-write period.

vdev_guid = the number of sequential cycles of the MMP thread looop when
this occurred.

Sample output, truncated to fit:

    [19 lines not shown]

OpenZFS on OS X/zfs 2679349module/zfs mmp.c

Detect long config lock acquisition in mmp

If something holds the config lock as a writer for too long, MMP will
fail to issue MMP writes in a timely manner.  This will result either in
the pool being suspended, or in an extreme case, in the pool not being
protected.

If the time to acquire the config lock exceeds 1/10 of the minimum
zfs_multihost_interval, report it in the zfs debug log.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
DeltaFile
+6-0module/zfs/mmp.c
+6-01 files

OpenZFS on OS X/zfs a34aa0dinclude/sys spa.h vdev_impl.h, module/zfs spa_stats.c mmp.c

Report duration and error in mmp_history entries

After an MMP write completes, update the relevant mmp_history entry
with the time between submission and completion, and the error
status of the write.

[faaland1 at toss3a zfs]$ cat /proc/spl/kstat/zfs/pool/multihost
39 0 0x01 100 8800 69147946270893 72723903122926
id       txg     timestamp  error  duration   mmp_delay    vdev_guid
10607    1166    1518985089 0      138301     637785455    4882...
10608    1166    1518985089 0      136154     635407747    1151...
10609    1166    1518985089 0      803618560  633048078    9740...
10610    1166    1518985090 0      144826     633048078    4882...
10611    1166    1518985090 0      164527     666187671    1151...

Where duration = gethrtime_in_done_fn - gethrtime_at_submission, and
error = zio->io_error.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>

OpenZFS on OS X/zfs 7ef8f65module/zfs mmp.c

Do not initiate MMP writes while pool is suspended

While the pool is suspended on host A, it may be imported on host B.
If host A continued to write MMP blocks, it would be blindly
overwriting MMP blocks written by host B, and the blocks written by
host A would have outdated txg information.

Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Olaf Faaland <faaland1 at llnl.gov>
DeltaFile
+1-1module/zfs/mmp.c
+1-11 files

OpenZFS on OS X/zfs 7162533tests/zfs-tests/tests/functional/mmp mmp.kshlib

Correct count_uberblocks in mmp.kshlib

A log_must call was causing count_uberblocks to return more
than just the uberblock count. Remove the log_must since it
was only logging a sleep.

Reviewed-by: Brian Behlendorf <behlendorf1 at llnl.gov>
Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: loli10K <ezomori.nozomu at gmail.com>
Signed-off-by: Giuseppe Di Natale <dinatale2 at llnl.gov>

OpenZFS on OS X/zfs 929b0d8module/zfs mmp.c

mmp should use a fixed tag for spa_config locks

mmp_write_uberblock() and mmp_write_done() should the same tag
for spa_config_locks.

Reviewed-by: Olaf Faaland <faaland1 at llnl.gov>
Reviewed-by: Giuseppe Di Natale <dinatale2 at llnl.gov>
Reviewed by: Brian Behlendorf <behlendorf1 at llnl.gov>
Signed-off-by: Sanjeev Bagewadi <sanjeev.bagewadi at gmail.com>
DeltaFile
+4-3module/zfs/mmp.c
+4-31 files