Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3633323imu; Mon, 28 Jan 2019 08:10:09 -0800 (PST) X-Google-Smtp-Source: ALg8bN5OfhBi7TqHc5JBhP2wY+Gd3HJvfW3cB2F3s33W4bjhUPbWt/TepFzn0mhyfhc/L59LBT/R X-Received: by 2002:a63:c00b:: with SMTP id h11mr20742547pgg.429.1548691809082; Mon, 28 Jan 2019 08:10:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548691809; cv=none; d=google.com; s=arc-20160816; b=ac8vm/ptzPzBLSTjKWqIP6Yrhhw88Jcao4ieZ96kADWdc99+NPnLm+7Uvpc2hM1vWF 1CROo9Y+1YvB+SiUT10wF4XkTC4HtAZDKCVr9h960uVGBGDypocmyIO+4ZNOjUZcXYFw yPp/VQyypYVrZtwwvxEBwuvBuFKJ1Bin6Hebq2RnVQ1h1wTU/66bIXL+mwpTzWeKji/q VHmCv+rGu/whN2qHhKhAtt4xuZ8U2aA/gnFD5xA1YQfW13iJ5QA3NGVsNtqKFO05J9rX Gr3xJO71+Hmju8j458ve1sShktI14cqgg9StVBcyUbIZ6XnEyHKHK4L47WQfvoiH8c5B LYzg== 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=+GlpNI2NTouMiAfGWEqL9Ti6442M+7B9uEQURJ9Ie68=; b=uWLt/PmwyttdoP+00KZKXBwI6RObX3I2oA0ssDLDvbsZyQgi4NpmF8X7PcvY7cg5HE iEei/pwc5idpY01Si21iU5jidFTAnkQWAwQwAbmNSLEjPPkzh+xKsHPpF1QiPA0B+wkh dmkkAHti5J9yOCvMyBmJ0IPMVuPC0M9NJoEnPhLZW/w9KLaDYotGYDn4IPtlBA8mq3tT RZJF7P8cGjLTLDROd9Act9UFA6GMW1ldgTX681L9B4Nyr/SV17cMBd6pH8Jp2o6J/uuM ZNOfCbCSVwNEa9EfNl/CyZIrlhvXzUDFWWBDh9rj49jgzTqaYn2GeDxmTOCithZa1I7A 3/Aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=MvrZfryN; 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 cd16si34474779plb.47.2019.01.28.08.09.52; Mon, 28 Jan 2019 08:10:09 -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=MvrZfryN; 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 S1732508AbfA1QI6 (ORCPT + 99 others); Mon, 28 Jan 2019 11:08:58 -0500 Received: from mail.kernel.org ([198.145.29.99]:32922 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731323AbfA1QIz (ORCPT ); Mon, 28 Jan 2019 11:08:55 -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 BACCA2084A; Mon, 28 Jan 2019 16:08:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1548691734; bh=NDeYd5wAHqGzv9cbV2K7xwrtZU8tlfGGI+8gol9aNDI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MvrZfryNfwfKFAy5AHUqEAIcayk7I9eBOJB64JVCMAgMV+mdd3DH0gt1yR4ZsXo19 pgrPDuxf9int3k2ad52e72ULjsO5e9zH7Q/tzcRsYjEEvl6KeQKm9tq1/YaKwd9thY szWov2hdJovm2QEpAngso3X5csxpMMCsNSMN3V6k= 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 200/258] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Date: Mon, 28 Jan 2019 10:58:26 -0500 Message-Id: <20190128155924.51521-200-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 b17b59602b6dcf8f97a7dc7bc489a48388d7063a ] With "on-no-data-accessible suspend-io", DRBD requires the next attach or connect to be to the very same data generation uuid tag it lost last. If we first lost connection to the peer, then later lost connection to our own disk, we would usually refuse to re-connect to the peer, because it presents the wrong data set. However, if the peer first connects without a disk, and then attached its disk, we accepted that same wrong data set, which would be "unexpected" by any user of that DRBD and cause "undefined results" (read: very likely data corruption). The fix is to forcefully disconnect as soon as we notice that the peer attached to the "wrong" dataset. Signed-off-by: Lars Ellenberg Signed-off-by: Jens Axboe Signed-off-by: Sasha Levin --- drivers/block/drbd/drbd_receiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/block/drbd/drbd_receiver.c b/drivers/block/drbd/drbd_receiver.c index 45ac5fe288e4..cb919b964066 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -4142,7 +4142,7 @@ static int receive_uuids(struct drbd_connection *connection, struct packet_info kfree(device->p_uuid); device->p_uuid = p_uuid; - if (device->state.conn < C_CONNECTED && + if ((device->state.conn < C_CONNECTED || device->state.pdsk == D_DISKLESS) && device->state.disk < D_INCONSISTENT && device->state.role == R_PRIMARY && (device->ed_uuid & ~((u64)1)) != (p_uuid[UI_CURRENT] & ~((u64)1))) { -- 2.19.1