mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 18:40:43 +03:00
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
This commit is contained in:
committed by
Brian Behlendorf
parent
60f5103445
commit
0582e40322
@@ -326,6 +326,7 @@ ztest_func_t ztest_spa_create_destroy;
|
||||
ztest_func_t ztest_fault_inject;
|
||||
ztest_func_t ztest_ddt_repair;
|
||||
ztest_func_t ztest_dmu_snapshot_hold;
|
||||
ztest_func_t ztest_mmp_enable_disable;
|
||||
ztest_func_t ztest_spa_rename;
|
||||
ztest_func_t ztest_scrub;
|
||||
ztest_func_t ztest_dsl_dataset_promote_busy;
|
||||
@@ -375,6 +376,7 @@ ztest_info_t ztest_info[] = {
|
||||
ZTI_INIT(ztest_fault_inject, 1, &zopt_sometimes),
|
||||
ZTI_INIT(ztest_ddt_repair, 1, &zopt_sometimes),
|
||||
ZTI_INIT(ztest_dmu_snapshot_hold, 1, &zopt_sometimes),
|
||||
ZTI_INIT(ztest_mmp_enable_disable, 1, &zopt_sometimes),
|
||||
ZTI_INIT(ztest_reguid, 1, &zopt_rarely),
|
||||
ZTI_INIT(ztest_spa_rename, 1, &zopt_rarely),
|
||||
ZTI_INIT(ztest_scrub, 1, &zopt_rarely),
|
||||
@@ -2660,6 +2662,47 @@ ztest_spa_create_destroy(ztest_ds_t *zd, uint64_t id)
|
||||
(void) rw_unlock(&ztest_name_lock);
|
||||
}
|
||||
|
||||
/*
|
||||
* Start and then stop the MMP threads to ensure the startup and shutdown code
|
||||
* works properly. Actual protection and property-related code tested via ZTS.
|
||||
*/
|
||||
/* ARGSUSED */
|
||||
void
|
||||
ztest_mmp_enable_disable(ztest_ds_t *zd, uint64_t id)
|
||||
{
|
||||
ztest_shared_opts_t *zo = &ztest_opts;
|
||||
spa_t *spa = ztest_spa;
|
||||
|
||||
if (zo->zo_mmp_test)
|
||||
return;
|
||||
|
||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
||||
mutex_enter(&spa->spa_props_lock);
|
||||
|
||||
if (!spa_multihost(spa)) {
|
||||
spa->spa_multihost = B_TRUE;
|
||||
mmp_thread_start(spa);
|
||||
}
|
||||
|
||||
mutex_exit(&spa->spa_props_lock);
|
||||
spa_config_exit(spa, SCL_CONFIG, FTAG);
|
||||
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
mmp_signal_all_threads();
|
||||
txg_wait_synced(spa_get_dsl(spa), 0);
|
||||
|
||||
spa_config_enter(spa, SCL_CONFIG, FTAG, RW_READER);
|
||||
mutex_enter(&spa->spa_props_lock);
|
||||
|
||||
if (spa_multihost(spa)) {
|
||||
mmp_thread_stop(spa);
|
||||
spa->spa_multihost = B_FALSE;
|
||||
}
|
||||
|
||||
mutex_exit(&spa->spa_props_lock);
|
||||
spa_config_exit(spa, SCL_CONFIG, FTAG);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
void
|
||||
ztest_spa_upgrade(ztest_ds_t *zd, uint64_t id)
|
||||
|
||||
Reference in New Issue
Block a user