From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 30E90C282CE for ; Mon, 11 Feb 2019 15:39:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 00185222A8 for ; Mon, 11 Feb 2019 15:39:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549899591; bh=U9OOULiVYMifsBkIQgWzX857dD4hduMX3VskumbYgdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vbK70s4f58E1NaRqTs51h81Mwq8NLziPB5KJSVzm1dA1PsRY8KIFYi9o57Mcfk/MX lMXQRkWl2F/p8mbm5bJDFvyFUalUxq2gayicnDMcn4nvSU1i/f7HuiMmaEzVkP8UDG 4VFdtNrBWT2V+vFiOTZOJdCMD9vYmJJRm9rUOj5A= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729297AbfBKPjo (ORCPT ); Mon, 11 Feb 2019 10:39:44 -0500 Received: from mail.kernel.org ([198.145.29.99]:34698 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387820AbfBKOtK (ORCPT ); Mon, 11 Feb 2019 09:49:10 -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 AE9A320855; Mon, 11 Feb 2019 14:49:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549896550; bh=U9OOULiVYMifsBkIQgWzX857dD4hduMX3VskumbYgdM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=1DYCvC6Du1jWrLeMI2CpeOV/40ZyIb37mwiPBth0wPos6E69kwKkzz2w+fuCOCfe+ LC6FL6dXEoM3hF3EEZb6gclfUHBNFyJtLI+e3JS/NjqNzdL7rMzlnVVJujvmaL374e 0IXo1EYiJadTM/fvF5UzedbjXPkC0MiuidWZ6ovk= 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.19 191/313] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Date: Mon, 11 Feb 2019 15:17:51 +0100 Message-Id: <20190211141906.022545214@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141852.749630980@linuxfoundation.org> References: <20190211141852.749630980@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: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org 4.19-stable review patch. If anyone has any objections, please let me know. ------------------ [ 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