-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add callback for zfs_multihost_interval
Add a callback to wake all running mmp threads when zfs_multihost_interval is changed. This is necessary when the interval is changed from a very large value to a significantly lower one, while pools are imported that have the multihost property enabled. Without this commit, the mmp thread does not wake up and detect the new interval until after it has waited the old multihost interval time. A user monitoring mmp writes via the provided kstat would be led to believe that the changed setting did not work. Added a test in the ZTS under mmp to verify the new functionality is working. Added a test to ztest which starts and stops mmp threads, and calls into the code to signal sleeping mmp threads, to test for deadlocks or similar locking issues. Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Olaf Faaland <faaland1@llnl.gov> Closes #6387
- Loading branch information
1 parent
60f5103
commit 0582e40
Showing
7 changed files
with
164 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
tests/zfs-tests/tests/functional/mmp/mmp_reset_interval.ksh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/ksh -p | ||
# | ||
# CDDL HEADER START | ||
# | ||
# This file and its contents are supplied under the terms of the | ||
# Common Development and Distribution License ("CDDL"), version 1.0. | ||
# You may only use this file in accordance with the terms of version | ||
# 1.0 of the CDDL. | ||
# | ||
# A full copy of the text of the CDDL should have accompanied this | ||
# source. A copy of the CDDL is also available via the Internet at | ||
# http://www.illumos.org/license/CDDL. | ||
# | ||
# CDDL HEADER END | ||
# | ||
|
||
# | ||
# Copyright (c) 2017 by Lawrence Livermore National Security, LLC. | ||
# | ||
|
||
# DESCRIPTION: | ||
# Ensure that the MMP thread is notified when zfs_multihost_interval is | ||
# reduced. | ||
# | ||
# STRATEGY: | ||
# 1. Set zfs_multihost_interval to much longer than the test duration | ||
# 2. Create a zpool and enable multihost | ||
# 3. Verify no MMP writes occurred | ||
# 4. Set zfs_multihost_interval to 1 second | ||
# 5. Sleep briefly | ||
# 6. Verify MMP writes began | ||
# | ||
|
||
. $STF_SUITE/include/libtest.shlib | ||
. $STF_SUITE/tests/functional/mmp/mmp.cfg | ||
. $STF_SUITE/tests/functional/mmp/mmp.kshlib | ||
|
||
verify_runnable "both" | ||
|
||
function cleanup | ||
{ | ||
default_cleanup_noexit | ||
log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_DEFAULT | ||
log_must mmp_clear_hostid | ||
} | ||
|
||
log_assert "mmp threads notified when zfs_multihost_interval reduced" | ||
log_onexit cleanup | ||
|
||
log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_HOUR | ||
log_must mmp_set_hostid $HOSTID1 | ||
|
||
default_setup_noexit $DISK | ||
log_must zpool set multihost=on $TESTPOOL | ||
|
||
prev_count=$(wc -l /proc/spl/kstat/zfs/$TESTPOOL/multihost | cut -f1 -d' ') | ||
log_must set_tunable64 zfs_multihost_interval $MMP_INTERVAL_DEFAULT | ||
|
||
# slight delay to allow time for the mmp write to complete | ||
sleep 1 | ||
curr_count=$(wc -l /proc/spl/kstat/zfs/$TESTPOOL/multihost | cut -f1 -d' ') | ||
|
||
if [ $curr_count -eq $prev_count ]; then | ||
log_fail "mmp writes did not start when zfs_multihost_interval reduced" | ||
fi | ||
|
||
log_pass "mmp threads notified when zfs_multihost_interval reduced" |