]> git.proxmox.com Git - zfsonlinux.git/blame - zfs-patches/0049-Detect-long-config-lock-acquisition-in-mmp.patch
update SPL to 0.7.7
[zfsonlinux.git] / zfs-patches / 0049-Detect-long-config-lock-acquisition-in-mmp.patch
CommitLineData
75b07eca
FG
1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2From: Olaf Faaland <faaland1@llnl.gov>
3Date: Tue, 20 Feb 2018 17:33:51 -0800
4Subject: [PATCH] Detect long config lock acquisition in mmp
5MIME-Version: 1.0
6Content-Type: text/plain; charset=UTF-8
7Content-Transfer-Encoding: 8bit
8
9If something holds the config lock as a writer for too long, MMP will
10fail to issue MMP writes in a timely manner. This will result either in
11the pool being suspended, or in an extreme case, in the pool not being
12protected.
13
14If the time to acquire the config lock exceeds 1/10 of the minimum
15zfs_multihost_interval, report it in the zfs debug log.
16
17Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
18Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
19Closes #7212
20(cherry picked from commit c17922b8a9db00ad7e7d59a5ff975b2a1edcf887)
21Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
22---
23 module/zfs/mmp.c | 6 ++++++
24 1 file changed, 6 insertions(+)
25
26diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
27index ee8e9201b..634e48287 100644
28--- a/module/zfs/mmp.c
29+++ b/module/zfs/mmp.c
30@@ -323,7 +323,13 @@ mmp_write_uberblock(spa_t *spa)
31 int label;
32 uint64_t offset;
33
34+ hrtime_t lock_acquire_time = gethrtime();
35 spa_config_enter(spa, SCL_STATE, mmp_tag, RW_READER);
36+ lock_acquire_time = gethrtime() - lock_acquire_time;
37+ if (lock_acquire_time > (MSEC2NSEC(MMP_MIN_INTERVAL) / 10))
38+ zfs_dbgmsg("SCL_STATE acquisition took %llu ns\n",
39+ (u_longlong_t)lock_acquire_time);
40+
41 vd = mmp_random_leaf(spa->spa_root_vdev);
42 if (vd == NULL) {
43 spa_config_exit(spa, SCL_STATE, FTAG);
44--
452.14.2
46