]> git.proxmox.com Git - zfsonlinux.git/blob - zfs-patches/0048-Detect-long-config-lock-acquisition-in-mmp.patch
revert potentially buggy zap_add change
[zfsonlinux.git] / zfs-patches / 0048-Detect-long-config-lock-acquisition-in-mmp.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Olaf Faaland <faaland1@llnl.gov>
3 Date: Tue, 20 Feb 2018 17:33:51 -0800
4 Subject: [PATCH] Detect long config lock acquisition in mmp
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 If something holds the config lock as a writer for too long, MMP will
10 fail to issue MMP writes in a timely manner. This will result either in
11 the pool being suspended, or in an extreme case, in the pool not being
12 protected.
13
14 If the time to acquire the config lock exceeds 1/10 of the minimum
15 zfs_multihost_interval, report it in the zfs debug log.
16
17 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
18 Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
19 Closes #7212
20 (cherry picked from commit c17922b8a9db00ad7e7d59a5ff975b2a1edcf887)
21 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
22 ---
23 module/zfs/mmp.c | 6 ++++++
24 1 file changed, 6 insertions(+)
25
26 diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
27 index 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 --
45 2.14.2
46