diff options
author | Olaf Faaland <[email protected]> | 2018-02-20 17:33:51 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2018-03-06 15:14:39 -0800 |
commit | 14c240cede5b38a761deedc2e23821a3f983da00 (patch) | |
tree | 0633ad7a3a9bff8c2dca7e45f4c6d078f825862e /module/zfs/mmp.c | |
parent | c7b55e71b0c24b836f8de56554cd1b0270c363ff (diff) |
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 <[email protected]>
Signed-off-by: Olaf Faaland <[email protected]>
Closes #7212
Diffstat (limited to 'module/zfs/mmp.c')
-rw-r--r-- | module/zfs/mmp.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c index 2d740e025..a668e8dbd 100644 --- a/module/zfs/mmp.c +++ b/module/zfs/mmp.c @@ -323,7 +323,13 @@ mmp_write_uberblock(spa_t *spa) int label; uint64_t offset; + hrtime_t lock_acquire_time = gethrtime(); spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER); + lock_acquire_time = gethrtime() - lock_acquire_time; + if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10)) + zfs_dbgmsg("SCL_STATE acquisition took %llu ns\n", + (u_longlong_t)lock_acquire_time); + vd = mmp_random_leaf(spa->spa_root_vdev); if (vd == NULL) { spa_config_exit(spa, SCL_STATE, FTAG); |