Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp2689580imj; Mon, 11 Feb 2019 07:04:23 -0800 (PST) X-Google-Smtp-Source: AHgI3IZfc53p4BEC/CE0K6p4godParV7mnOuUlePDWMIwxu6LejkFlYp3wEAXOVA7Xi4+38hoDRy X-Received: by 2002:aa7:8508:: with SMTP id v8mr6326544pfn.14.1549897462940; Mon, 11 Feb 2019 07:04:22 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549897462; cv=none; d=google.com; s=arc-20160816; b=vW9Fr0uXy8SKjcK6p3GrBTUhRG8Wo8XFQy5KgdaSG7tDDlHsiNLpkydWp7A5dCoQ12 HFvR3AOE8HzKHT143Mmj8asvec0oummI4pYRxsKGEHNuyRxqO/H6MoaFlToZniuxkn6A nOwrR4Baji7S6nRwEAu+I0zjBIU2H3o1gHTly09Qyxa0sW+Domm9D0+dIP/c2+SJ4Zyj OLUkWku/4hWsTADZPp9gLNTiV9O47PteWBGVq9GsEodpoSbL1XDhwxdWxAme+/WnKx0Y B9WxS0wNmiDmop10mjv6+duyoT7YTcxHZeX9ZDTX7owzBmm518Y+c/wWEyUOfGDKIN4I DcZw== 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=vP+Ptsw003Fl9Mdkm89GsLS4ArADUowxP0hXWv6aseU=; b=Zj+asP94k/Y+m/74dy7ub3cVNlWec2UC9NVJInKC0aku/trK16wAK4ehY6/8rFrGzE en73diy+WSEud4NiWCWPmsr9k4uIydqu6SaTjPJKkMMxZbj+4HW7/q6HOXlASkbH5f15 boIK7Kb0/QxvYiLRAUap07nIdTjGivklf5ctDAOmg0MrFq+53wJDzDLhe/3r4qO7D/Ye dXBbWSE78mTcoMkeDq842jFM6wu67AWEMBGhCuhXSVyO6ph7E6zR7gQy+6M95hM2FxjJ VjVpf/mLcvyzPc5Cq1T17UVLMe/hgrEyPyh/BYOEbFWzAGK/Lh19lJ7fhlx7vEcCJ+mv mngg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=mU7BrmfH; 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 o12si9377321pgv.252.2019.02.11.07.03.50; Mon, 11 Feb 2019 07:04:22 -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=mU7BrmfH; 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 S2390190AbfBKPB0 (ORCPT + 99 others); Mon, 11 Feb 2019 10:01:26 -0500 Received: from mail.kernel.org ([198.145.29.99]:49420 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390165AbfBKPBY (ORCPT ); Mon, 11 Feb 2019 10:01:24 -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 B4685222A6; Mon, 11 Feb 2019 15:01:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1549897283; bh=64LskGI5elZW7rrrJKV14uZZxUScz8ySNl6vTLM4Eto=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=mU7BrmfH4UU1mwNrsGBEBbS/dLZ/JCszuIDA95nlZvHTwpzLQVts0PamsYz0L467m bFiGn3OytZoU+dVSNcFgLYIHWkBfwP0r03uSxMtg7YtED57OOdW3U/q8sSIquLuamZ WlWrYHGIz4R7HKljIhq7wbY4gDsZgxVN0vLW9InE= 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.14 119/205] drbd: disconnect, if the wrong UUIDs are attached on a connected peer Date: Mon, 11 Feb 2019 15:18:37 +0100 Message-Id: <20190211141836.245486770@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190211141827.214852402@linuxfoundation.org> References: <20190211141827.214852402@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.14-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 143c5a666e25..1aad373da50e 100644 --- a/drivers/block/drbd/drbd_receiver.c +++ b/drivers/block/drbd/drbd_receiver.c @@ -4139,7 +4139,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