1#!/bin/ksh -p 2# 3# CDDL HEADER START 4# 5# This file and its contents are supplied under the terms of the 6# Common Development and Distribution License ("CDDL"), version 1.0. 7# You may only use this file in accordance with the terms of version 8# 1.0 of the CDDL. 9# 10# A full copy of the text of the CDDL should have accompanied this 11# source. A copy of the CDDL is also available via the Internet at 12# http://www.illumos.org/license/CDDL. 13# 14# CDDL HEADER END 15# 16 17# 18# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. 19# 20 21# DESCRIPTION: 22# Ensure that the MMP thread is writing uberblocks. 23# 24# STRATEGY: 25# 1. Set zfs_txg_timeout to large value 26# 2. Create a zpool 27# 3. Find the current "best" uberblock 28# 4. Sleep for enough time for a potential uberblock update 29# 5. Find the current "best" uberblock 30# 6. If the uberblock never changed, fail 31# 32 33. $STF_SUITE/include/libtest.shlib 34. $STF_SUITE/tests/functional/mmp/mmp.cfg 35. $STF_SUITE/tests/functional/mmp/mmp.kshlib 36 37verify_runnable "both" 38 39function cleanup 40{ 41 default_cleanup_noexit 42 log_must set_tunable64 TXG_TIMEOUT $TXG_TIMEOUT_DEFAULT 43 log_must rm -f $PREV_UBER $CURR_UBER 44 log_must mmp_clear_hostid 45} 46 47log_assert "mmp thread writes uberblocks (MMP)" 48log_onexit cleanup 49 50log_must set_tunable64 TXG_TIMEOUT $TXG_TIMEOUT_LONG 51log_must mmp_set_hostid $HOSTID1 52 53default_setup_noexit $DISK 54log_must zpool set multihost=on $TESTPOOL 55 56log_must eval "zdb -u $TESTPOOL > $PREV_UBER" 57log_must sleep 5 58log_must eval "zdb -u $TESTPOOL > $CURR_UBER" 59 60if diff -u "$CURR_UBER" "$PREV_UBER"; then 61 log_fail "mmp failed to update uberblocks" 62fi 63 64log_pass "mmp thread writes uberblocks (MMP) passed" 65