Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3633320imu; Mon, 28 Jan 2019 08:10:08 -0800 (PST) X-Google-Smtp-Source: ALg8bN4lAwnlexcpuj/4GPH9jO5C2a/X969BQxWQO2pLxjqaRdHGTrCJOz1btSp147tEv5m8ab98 X-Received: by 2002:a62:28c9:: with SMTP id o192mr22890490pfo.57.1548691808926; Mon, 28 Jan 2019 08:10:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691808; cv=none; d=google.com; s=arc-20160816; b=talgd65ld+te/JF5V1yDUgSXQiblRKaNYBJWt1EuRwoftsT3ooh9rCinBIRa0VqDzw IcBNc4sg/wbRgUC97CsKSx44kqahYALEQgD+H2zrzE39LlvN4lqOZrnwFJ3muKiG8YHX 7sDMPKQWqLR6zn5/pJ9Bu0u9hHi4/XEWHDDHV2lHaV42GUVrPnx+WGI1WdebpFRS+4C8 DJR+Lf+W6WVe90Hi9gT2wHB4jU85n9m9yjXlfhE/5SG99iK2vauEoL4zwzEf1H4gUjOs 4e4P6W3n95tngqhcX9mqw/tO6kMgCaLDlmhy8q8SwUWErrAOfVh/RsHVB2UaqX/7YsYC nIHA== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0VKxeZEC5vIeQjL1pkP2SetzfGULWX9IXN+Cw2mcQOI=; b=k4nqBgTUgKQBKRHgIlV/cuH4hH7xfsfLSqh7Ov5adbMTFab5rGJR/4T35yR5xiatQo roFS5KJtXjQfPWlAT/JNS5UEvwyVriaA8i0WdzRAXXvNTGBPh9JEyTk0Ai4NomHx6bKC 8qfmBDJE89wF6CuGa8p6Pxtqc6tL6KEd/Uy8kMaUFlAOlwZob4llNbXzXqWlrbRgpU9U BVGH6G8rMgqIrzRrbXXz1mePZlONUyM4SZyDCNX7U88XZbD81aybyAdmZZ2UjuvQx91G 1Ti5wgPr/86ypMH83+zZLz1kncW5oYeeDtTCoDHWWKbLF9JEy4dD7dGBtTwN9B5OvXav OBsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Zmc9PteG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p22si32482643pgl.340.2019.01.28.08.09.53; Mon, 28 Jan 2019 08:10:08 -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=Zmc9PteG; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732520AbfA1QI7 (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:33024 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731791AbfA1QI6 (ORCPT ); Mon, 28 Jan 2019 11:08:58 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 2B6D52171F; Mon, 28 Jan 2019 16:08:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691737; bh=kvd6SCuFjLXEg6fBXeeGAC2wwZDWOhHBApd/DZXiTJg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Zmc9PteGeaUrjq6X6D2TT6dl9Mg+res0O3IFFtMnAddAtKnAzOuCrYFmdce9m//Nb xIZPfUCTgPjPSpLcYVSXkFo3QDBUZsj6VCDxFZCkUn3fVr3lrLLUOJ49CGMfG8SwA0 VUA5mdbnrU775cpKJcx2t5G1mLHG9bNegAcJxK5M= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Lars Ellenberg , Jens Axboe , Sasha Levin , drbd-dev@lists.linbit.com, linux-block@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 201/258] drbd: skip spurious timeout (ping-timeo) when failing promote Date: Mon, 28 Jan 2019 10:58:27 -0500 Message-Id: <20190128155924.51521-201-sashal@kernel.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20190128155924.51521-1-sashal@kernel.org> References: <20190128155924.51521-1-sashal@kernel.org> MIME-Version: 1.0 X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lars Ellenberg [ 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 b4f02768ba47..319fabdd63a3 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