1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Olaf Faaland <faaland1@llnl.gov>
3 Date: Thu, 8 Mar 2018 15:21:54 -0800
4 Subject: [PATCH] Handle zio_resume and mmp => off
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 When multihost is disabled on a pool, and the pool is resumed via zpool
10 clear, within a single cycle of the mmp thread's loop (e.g. while it's
11 in the cv_timedwait call), both mmp_last_write and mmp_delay should be
14 The original code mistakenly treated the two cases as if they could not
15 occur at the same time.
17 Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
18 Reviewed-by: Tony Hutter <hutter2@llnl.gov>
19 Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
21 (cherry picked from commit 267fd7b0f14251026c35d7ceab4fbbe2f06717e6)
22 Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
24 module/zfs/mmp.c | 14 ++++++++++----
25 1 file changed, 10 insertions(+), 4 deletions(-)
27 diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c
28 index 634e48287..15eea41ab 100644
29 --- a/module/zfs/mmp.c
30 +++ b/module/zfs/mmp.c
31 @@ -409,16 +409,22 @@ mmp_thread(spa_t *spa)
35 - * When MMP goes off => on, or spa goes suspended =>
36 - * !suspended, we know no writes occurred recently. We
37 - * update mmp_last_write to give us some time to try.
38 + * MMP off => on, or suspended => !suspended:
39 + * No writes occurred recently. Update mmp_last_write to give
40 + * us some time to try.
42 if ((!last_spa_multihost && multihost) ||
43 (last_spa_suspended && !suspended)) {
44 mutex_enter(&mmp->mmp_io_lock);
45 mmp->mmp_last_write = gethrtime();
46 mutex_exit(&mmp->mmp_io_lock);
47 - } else if (last_spa_multihost && !multihost) {
52 + * mmp_delay == 0 tells importing node to skip activity check.
54 + if (last_spa_multihost && !multihost) {
55 mutex_enter(&mmp->mmp_io_lock);
57 mutex_exit(&mmp->mmp_io_lock);