Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1347402imu; Thu, 20 Dec 2018 14:46:52 -0800 (PST) X-Google-Smtp-Source: ALg8bN6K9mGRSTJcJukdkka2m0fXkUQ9NYczJ5GR5a+rMEX8Lq6OYo4UhPPJk4DESiXsU8qbh3Pt X-Received: by 2002:a17:902:3283:: with SMTP id z3mr110445plb.76.1545346012290; Thu, 20 Dec 2018 14:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545346012; cv=none; d=google.com; s=arc-20160816; b=KR1+k8UZx0xyxb4wsPruj7jlXFZ/RVLnk42DlpBoKoWAYhivKYh7OoRHoUywiAZofp Fd8C5IFuu/aUIYANdQist6qnfFFH1xMXR+H3ymxJHWVz2/+nkVma1QTyBeOwN3UUEOcW UeIMHIMjQKUgkat7+OV97DY0hJLOCS+l6APIfU4LPnccaGKkpUY4OOTa/RJJswsf727y /scs89+S31e7Sl3M1OZCcV2aR5ERlbgtCU5u+oV/NgnOtQCMdiVXOxKwPQId88MXim12 +IhnduW0+wGACLhu95qgoIn+NjOrrwVx/zfDsrszLCwGFCyw+ZjacELph9AmG+l8ym8+ 2ihQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=CWQvsXfOtT3TcZsq0rH2ZDCWAjwbNhnu6sjvm6v0Pgo=; b=QHeA1zeyJnD9oDOcS9yETN+Id9mpKryJergv/OeqXanXJt2GoTui+V99b7OAfsqE3C 6XJnpy8ZAsw+E2t/65+zC0p+uLsFkESJ9NU62c0mkfXIOybz5brp33oK9b/43Hq5QU6l bg7QdnhoYYv2B0WafIMb1DI7ChaBKtyaNJGTEcGJ1OwFk4BIvGFzZpli/dv0Yi0PuO5M Xz0s3cVDD/ghFJzLTVmCBGTQKhjVPlrQ2bruUDMJpFOFkZjWUpZVH0z3NucAK2nObr4R CAwHSksJ5Kx4QeUpFOIuaM+hct10BsFTLOmoVFaSY9bHhK98dSglINuL+pAd8rKV2MEb uHDg== ARC-Authentication-Results: i=1; mx.google.com; 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 x6si19137306pgh.363.2018.12.20.14.46.05; Thu, 20 Dec 2018 14:46:52 -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; 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 S1730989AbeLTQjp (ORCPT + 99 others); Thu, 20 Dec 2018 11:39:45 -0500 Received: from mail09.linbit.com ([212.69.161.110]:50124 "EHLO mail09.linbit.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730787AbeLTQjk (ORCPT ); Thu, 20 Dec 2018 11:39:40 -0500 Received: from soda.linbit (212-186-191-219.static.upcbusiness.at [212.186.191.219]) by mail09.linbit.com (LINBIT Mail Daemon) with ESMTP id E15731045C35; Thu, 20 Dec 2018 17:23:49 +0100 (CET) From: Lars Ellenberg To: Jens Axboe , linux-kernel@vger.kernel.org, linux-block@vger.kernel.org Cc: drbd-dev@lists.linbit.com Subject: [PATCH 14/17] drbd: skip spurious timeout (ping-timeo) when failing promote Date: Thu, 20 Dec 2018 17:23:41 +0100 Message-Id: <20181220162344.8430-15-lars.ellenberg@linbit.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181220162344.8430-1-lars.ellenberg@linbit.com> References: <20181220162344.8430-1-lars.ellenberg@linbit.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 82915880c5e9..bfe1b0062d62 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -697,14 +697,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.17.1