10499 Multi-modifier protection (MMP)

Review Request #1582 - Created March 26, 2019 and submitted

Jerry Jelinek

Port of all of the ZoL MMP patches.

For code review, here is a summary of the changes I made for the port.
- common/zfs/zfs_comutil.h ZoL uses Linux errno EREMOTEIO, so I added a define for this to use a valid illumos errno
- in mmp.c commented out calls to spa_mmp_history_add & spa_mmp_history_set_skip since we doen't have the ZoL spa kstat infrastructure yet
- mmp.c: In Zol used 'cv_timedwait_sig_hires' which is not exposed in illumos, changed to use cv_timedwait_sig_hrtime
- added cv_timedwait_sig_hrtime to libfakekernel
- zpool_main.c - changed the error msg to refer to hostid SMF svc
- ZoL spl sys/sysmacros.h includes sys/debug.h, but our sys/sysmacros.h does not, added include in zpool_main.c
- added get_system_hostid() to libzfs and implemented the ztest env var there for illumos. ZoL added that in their SPL.
- ../zdb.c:5445: error: missing initializer [-Wmissing-field-initializers], fixed Makefile.com
- fixed libtest.shlib get_tunable_impl so it works on illumos
- misc fixes in the mmp tests to make them work on illumos

Here is the list of relevant ZoL patches included in this port:
db2af93d7 Increase default zfs_multihost_fail_intervals and import_intervals
3d31aad83 MMP writes rotate over leaves
8133679ff Do not resume a pool if multihost is enabled
4f3218aed Warn user about accidentally sharing devices
107dd2b17 Use proper tag for spa config refcounts in mmp_write_uberblock()
5365b0747 Add missing MMP status code to libzfs_status
34fe773e3 Skip import activity test in more zdb code paths
520023771 MMP should not suspend pool in ztest
bc5f51c5d module param callbacks check for initialized spa (XXX part)
0ba106e75 Fix divide-by-zero in mmp_delay_update()
533ea0415 Update mmp_delay on sync or skipped, failed write
cec3a0a1b Report pool suspended due to MMP
b7eec00f9 Fix MMP write frequency for large pools
ebed90a59 Handle zio_resume and mmp => off
d2160d053 Record skipped MMP writes in multihost_history
14c240ced Detect long config lock acquisition in mmp
7088545d0 Report duration and error in mmp_history entries
0d398b256 Do not initiate MMP writes while pool is suspended
f2c0dee23 Correct count_uberblocks in mmp.kshlib
918dbe35b mmp should use a fixed tag for spa_config locks
51d1b58ef Emit an error message before MMP suspends pool
bbffb59ef Fix multihost stale cache file import
b33d668dd Fix ZTS MMP tests and ztest -M behavior
d410c6d9f Reimplement vdev_random_leaf and rename it
af0f84288 mmp_on_uberblocks: Use kstat for uberblock counts
e889f0f52 Report MMP_STATE_NO_HOSTID immediately
0582e4032 Add callback for zfs_multihost_interval
ffb195c25 Release SCL_STATE in map_write_done()
b6e5c4038 Use correct macro for hz in mmp.c
802ae562e Fix coverity defects: CID 165755
cc9c6bcb7 Fix vdev_probe() call outside SCL_STATE_ALL lock
ff998d804 Ignore dataset if the dds_type is DMU_OST_OTHER
379ca9cf2 Multi-modifier protection (MMP)

zfs-test run. All new mmp tests pass.

Andrew Stormont
Toomas Soome
Kody Kantor
Jerry Jelinek
Review request changed

Status: Closed (submitted)