Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2461293imj; Mon, 18 Feb 2019 06:26:35 -0800 (PST) X-Google-Smtp-Source: AHgI3IaS/9dut2L0Y4I8wCWBxa3IqZwvQ+1qaoVVr7bKCHf1dUa6U1+R03WMbBa7Dcm14YS6X70C X-Received: by 2002:a63:c303:: with SMTP id c3mr19096839pgd.268.1550499995330; Mon, 18 Feb 2019 06:26:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550499995; cv=none; d=google.com; s=arc-20160816; b=trfoDx2jvboRkV5VMzuxiCvM8XWtLyFIL4SLrLfv4iEIGbJsYPnb+z7/diDOBq2dk1 AAG0Hqi3p4wieYr+k3su4/ZxE5evA6ccTHz0mX3vXYc/HmOTAE/WjMjA5OR0zMUnxRFe bT93ZLjJuHXtemfeflVETHNaLZrNcN1bIQNMrlWT+yQ7S10vpoCmHzXqqUZgrlb+Aq8L 0W9ovxo4Q4qgysQuvHIqvVyXgS1UZp3kYwNtU5R2LdeYOr8CTmCAnGbu/jCnEb7VmHWC szLcL29GFEvJTPqATDLS1fCDPX5lFscEu8eknASu//9hwbJsm2XARraw37Od0su0TJ8E hosA== 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=bV2ma1aoy8CzadoagpBwxbDCTXF51yE5PHvtxSilxuI=; b=dO+OIDYIIHK7n3VDqulGFnWc8rNHEGcJwZULDUYi05H1JOrypHOFILdteMe1DpTph/ UvykUsfTUNbm4c5XxEZwTj3eTbnQd0+I+HxtGtlzyLKhXDrsQtLVzkne0V6JkHP0AcRm 77u+CAGBwOgSxXVHe96h0GZsoubKjFna6VhBbgdm8nzILSC78RKpUfYG03kJcKZuxS+Z UimzMFZcltwwTW+/1jriVhUAapi35W33+EyDSP2+JOh35kG40BTqLXb0IwXE8gcqR8D4 aU222op5ISb9GDvlWPXlJKF7ON1vwf8sVSzSKQ/hxCE84pOywUn639qQiZDI2qL22RBQ XJYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=uun19XBe; 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 11si10068341plc.383.2019.02.18.06.26.19; Mon, 18 Feb 2019 06:26:35 -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=uun19XBe; 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 S2388406AbfBROED (ORCPT + 99 others); Mon, 18 Feb 2019 09:04:03 -0500 Received: from mail.kernel.org ([198.145.29.99]:45946 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389765AbfBRODw (ORCPT ); Mon, 18 Feb 2019 09:03:52 -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 3353321902; Mon, 18 Feb 2019 14:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550498631; bh=UZI5IIupBkAGW+JDL690RohgpbngbwUXBdeSwDGG1as=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uun19XBeHD7ftLVSsKf8msAZ3fbq1hb1rCcifw/3WkUnrIkAzOiC5w6iYGOPSzkc3 Kwxptp9x7FjuhtCR2KDRzr9KjVWWv3AX+2NmJchA6orjjoVbZ4dAtF72HbAceDFeZd 6nvMuicvEutjHscAFaQryoH+1IvyhUjFnLcUxMww= 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.4 048/143] drbd: skip spurious timeout (ping-timeo) when failing promote Date: Mon, 18 Feb 2019 14:42:56 +0100 Message-Id: <20190218133530.888235816@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190218133529.099444112@linuxfoundation.org> References: <20190218133529.099444112@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.4-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 e80cbefbc2b5..27e1abcf5710 100644 --- a/drivers/block/drbd/drbd_nl.c +++ b/drivers/block/drbd/drbd_nl.c @@ -632,14 +632,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