Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2717134imj; Mon, 11 Feb 2019 07:26:16 -0800 (PST) X-Google-Smtp-Source: AHgI3IYTwcIMsUB7TmmujiPBRLTR8HPMYb0XxAf/MTLNQo7XHj5DE+Ka7w1TfWnY1O/y4dLnPlk2 X-Received: by 2002:a17:902:8b82:: with SMTP id ay2mr11988030plb.64.1549898776331; Mon, 11 Feb 2019 07:26:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549898776; cv=none; d=google.com; s=arc-20160816; b=PywrRwmftHFrGNfjBIa9bxVFr5TMpbGOy8O0/sOczRB6NnpNsMOUCwrgtdxg9YvEgn FXb9RdL1b1as1CWYmMmn1qIEqrS5q0HJ7KznK39uQzelBgCtcBs5VwTjPSqmFONu8+cH 85SCTeYJsQrMxZ8v2BzQ8/4RP3zx3rjAhG02FdhIPx+zPvXdeZT4nI6WnfwFa47iyJA8 EtX1RNkUnuSTDBGhoDFpVdUSedyHOhzH6zlfgbVDl2QfPApn/2xwkDnL/Oh/xk/XZckM ZipIo1UhFSX99AL+o+k5mRRBpukjX5tHuuqrQtl93H3iqt6vximmU3NQnIuhVDNjPEys M3OQ== 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=GUVL1isbnPacMeJG7TXJAXh578LY1FtH7qaxU9OPWcU=; b=inPUbfEfrreB154CXzn6P9mDxQfm36IEwiYtT/5O7cWtcfWlOx1YtLzrtTBrJ/yIR9 EZPmUTq4104SUxqHRsSGMLlfnj8ald1hRHhHxKWip7QAEilNR+xokgfj0ZjSMTCnLZKW dpLQK40nAMbxjFXJRcRb+E/s/7K4Hie3FRD9+NpNywi5Nsx5/Iheev0UUtlkif2AI2zH hDlBKpf8mK9EZGnTC0ONysMvPfGrLNw3JwfHIh740O4xdvs1ATSgCrPeUrAO0Jgy3r7R 33P9vEeDmSSGM+ttmIqvqaxJf7wcUik+mYK6SKHvUaWmlacjs0QYD/1LoC5Z4VKv3bq7 +XDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="md4u9/QV"; 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 ay7si10156750plb.410.2019.02.11.07.26.00; Mon, 11 Feb 2019 07:26:16 -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="md4u9/QV"; 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 S2390200AbfBKPB2 (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:28 -0500 Received: from mail.kernel.org ([198.145.29.99]:49484 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390184AbfBKPB0 (ORCPT ); Mon, 11 Feb 2019 10:01:26 -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 4EC36222A6; Mon, 11 Feb 2019 15:01:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897285; bh=jXvPU3mrDV1hm7Pt7PueN/8J69H2hul9B8x1EEz1VMQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=md4u9/QVbytOKd7DJwSF/kV53d5Ul2H/eMpvs2JkWA2kWPWDgiUsRQwY9FWjePp7C X/xDTpQQVIsPaS/uKBGa7TGInpN5zW82+vdI80/OCXp8GdNB9BV3HePX9acEJUvgeQ UqgAnH87VAsEhm/+BJ4u57dpE46eKNvm/nYASCnk= 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.14 120/205] drbd: skip spurious timeout (ping-timeo) when failing promote Date: Mon, 11 Feb 2019 15:18:38 +0100 Message-Id: <20190211141836.314466309@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 a12f77e6891e..ad13ec66c8e4 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