Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2755419imj; Mon, 11 Feb 2019 08:01:31 -0800 (PST) X-Google-Smtp-Source: AHgI3IY1basDNvHabk1bX9irsrHPRIZLPcMiOnHoAV63nhiLaqLeN3EHHYdRGRk2XP7I9HbA8b6y X-Received: by 2002:a17:902:8641:: with SMTP id y1mr38082270plt.159.1549900890961; Mon, 11 Feb 2019 08:01:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549900890; cv=none; d=google.com; s=arc-20160816; b=gPAuMiQUzHk1I8vW1ilTPbPXU/AHbz4EOT2tbryr+oTz6i2MvQemBTBCr40DXfjmvR GpepOy8U9I2YQhem5B1LX5zi7S6QuzGTtvroaDqSyLloT2nKwjXItOlIHVrKjJmweu0/ TOhCIP0VmlJfIGQAJ8z+U4SW5jtVi9jQASgaG+cZc+W6yYtFLIFkFvshqt5Zfvzz3VAO 9koGMmOLJz4OGatFcvkisC45RvhNV5FYOYF2psXdAn2o91rY1o0khsGdiAe0Xb1zFFca RVsgXSxh42NTDNkv91jVJQ5cbiE2fJl7FXL1Qx6PaUONfEXMhwLkda3V+g6EU0nWPLtE E0nA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SzKMNca9kYEDq/5+/TF+Xprb42h/4steCZngHaR+K9M=; b=ctbukT8ZVbXjag+wmKJwNNwMyQE5uwf6FxaezUZApSzGHgTYHmenc7IsBon9DSTkdO azwzc/0AR6j9neNV/OXzJOF0OjJ9nBse/vGn/DfXtgrBe9qt00P/hnwaB/MtDrkMzlcs C0xWOmu+1N+5DzAClwIJtt4vc2PrxZ6zJoGZsz18+Po9eSa9t0PF0aH3q3cKRGnQ1Q9R FhIp30Rg3VlmXLP6tAp1VNDXbmN/7POFN5Rm8IZH7HnXC6SI9pyN2UPy3VQXz4e/58gu spyfg77mTTV6Lsjdm3IKjhNJbrJClAy2iClIGQizDk1Ha596Ow2vr14u8L0OhwExOLXk vdnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uK+fQU2I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j132si10670658pfc.84.2019.02.11.08.01.09; Mon, 11 Feb 2019 08:01:30 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uK+fQU2I; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732114AbfBKQAQ (ORCPT + 99 others); Mon, 11 Feb 2019 11:00:16 -0500 Received: from mail.kernel.org ([198.145.29.99]:38796 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728767AbfBKObo (ORCPT ); Mon, 11 Feb 2019 09:31:44 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 6011720844; Mon, 11 Feb 2019 14:31:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549895503; bh=2gqXWdEQMKoGkA+8nirZVPf9Rewo3md/qQHEIcAItZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uK+fQU2IOU2k0R3whd1CQtLPjwLVdvHQTDKObEKg8HN2nJIwv4OYElMs/SX4F8D/p eNS/jdK9kMNdrxBpZAUXXOW5m33E65aCvCvo0HAScQ/8db9q9G077EbmGasImJANUV XT4UQhQzqnY7Z0BXvB3itr71Ul9znSMQaMPIf5S8= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lars Ellenberg , Jens Axboe , Sasha Levin Subject: [PATCH 4.20 227/352] drbd: skip spurious timeout (ping-timeo) when failing promote Date: Mon, 11 Feb 2019 15:17:34 +0100 Message-Id: <20190211141901.695028700@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141846.543045703@linuxfoundation.org> References: <20190211141846.543045703@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ [ Upstream commit 9848b6ddd8c92305252f94592c5e278574e7a6ac ] If you try to promote a Secondary while connected to a Primary and allow-two-primaries is NOT set, we will wait for "ping-timeout" to give this node a chance to detect a dead primary, in case the cluster manager noticed faster than we did. But if we then are *still* connected to a Primary, we fail (after an additional timeout of ping-timout). This change skips the spurious second timeout. Most people won't notice really, since "ping-timeout" by default is half a second. But in some installations, ping-timeout may be 10 or 20 seconds or more, and spuriously delaying the error return becomes annoying. Signed-off-by: Lars Ellenberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/drbd/drbd_nl.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/block/drbd/drbd_nl.c b/drivers/block/drbd/drbd_nl.c index d15703b1ffe8..714503173150 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -668,14 +668,15 @@ drbd_set_role(struct drbd_device *const device, enum drbd_role new_role, int for if (rv == SS_TWO_PRIMARIES) { /* Maybe the peer is detected as dead very soon... retry at most once more in this case. */ - int timeo; - rcu_read_lock(); - nc = rcu_dereference(connection->net_conf); - timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; - rcu_read_unlock(); - schedule_timeout_interruptible(timeo); - if (try < max_tries) + if (try < max_tries) { + int timeo; try = max_tries - 1; + rcu_read_lock(); + nc = rcu_dereference(connection->net_conf); + timeo = nc ? (nc->ping_timeo + 1) * HZ / 10 : 1; + rcu_read_unlock(); + schedule_timeout_interruptible(timeo); + } continue; } if (rv < SS_SUCCESS) { -- 2.19.1