Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp3911132imm; Mon, 8 Oct 2018 11:33:20 -0700 (PDT) X-Google-Smtp-Source: ACcGV62YYtUp0KxaN7SdSzJH+ccVX6bKFok6ecPY3ucwHrXr8Tej7yiSJ0NrONi5MJHUw1+Fd97I X-Received: by 2002:a62:18a:: with SMTP id 132-v6mr26436239pfb.207.1539023600786; Mon, 08 Oct 2018 11:33:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539023600; cv=none; d=google.com; s=arc-20160816; b=K99mj9k0PXXAt4wUl3VWbfE13g30iNtDv0zpUK5qOtUc52oIKwqKmj4KVWQYA7a8hv UerqIlCyFBcgkUsRaJzxQ3vaY1gxT7aOyKAYFQtEZUWNi0vS0cHk07I2iM5jx6ZDHnJ6 hX86Ck88FJvO2bsTNF2la+r9uRU/cp9wSL822UzJNgQfTsm/3u6rn4vl8pyhXpAazpYc 8AWXiwvnKIy9kS4EqyS8PmHLGtmJIhgEmY7m6m7vDp9dWVB6MUxKxhRSfg3+sI3MRlA/ N/u2iy2F8GRnVa7yrq7FNQ8KcT3HNIVmRX3+e+OfkxqEZLBcZnDCPfEGuOd/oRWhhT0H 0JtA== 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=N4QqhbNaw6+O/puBsnzZ3wg7INjLjAR+zOFGzP0tdrw=; b=YxxmvJOpceF70jk04Cb3cZDefiNSQeQW0T9vBsViqPD5MA26xgE1LEV+frsKE3tJtM rKtL8DSgBXJGxUtq6Kxn6R9E8u5TtJJ8ehf+bpWfQ2z6px5K1dphKhjOY8SnGDXcNczm xi1bJCdMubEbmbaLF9m22kKzInw4JUT+uM8z1VsLzHjJDlv91MS53S8WeGcxjqPeDzId L1tMnW51BMHapi84JXxi/heDPrsN1inox7muP5j69h08nO3Tz/73QtJXDzMQDsb1king bk9iP7/7AV7zJnmNr0hJxjTlQsme45jZAxnhJIvZPpCRTmUz9wse38aQcsVPqMGAoSXK DKPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Oh0CSZ9o; 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 e3-v6si19178520plk.114.2018.10.08.11.33.05; Mon, 08 Oct 2018 11:33:20 -0700 (PDT) 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=Oh0CSZ9o; 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 S1726683AbeJIBpx (ORCPT + 99 others); Mon, 8 Oct 2018 21:45:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:55478 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726434AbeJIBpw (ORCPT ); Mon, 8 Oct 2018 21:45:52 -0400 Received: from localhost (ip-213-127-77-176.ip.prioritytelecom.net [213.127.77.176]) (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 9F2602087D; Mon, 8 Oct 2018 18:32:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1539023570; bh=sfDcnVu8XfsGX/eMrsiLVl46oLmxdsg8FIx2B7NgxqQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Oh0CSZ9ot9co26T1LVRsom+i3HKLl0Taay27S792wBoDrTHX07xTXPATeWmD8iKX7 6XdfTkyWoZSZc2AlBwOB1z33wtdjs4kSqIxKAjDCP02Aw/1zRD9+htKPkEfmhHbkjl JqHjcBMZQdOGk7c9HabgNoCRFRh2XVP3tx+4Ev2U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Guoqing Jiang , NeilBrown , Shaohua Li , Sasha Levin Subject: [PATCH 4.4 011/113] md-cluster: clear another nodes suspend_area after the copy is finished Date: Mon, 8 Oct 2018 20:30:12 +0200 Message-Id: <20181008175531.394633401@linuxfoundation.org> X-Mailer: git-send-email 2.19.0 In-Reply-To: <20181008175530.864641368@linuxfoundation.org> References: <20181008175530.864641368@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review 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. ------------------ From: Guoqing Jiang [ Upstream commit 010228e4a932ca1e8365e3b58c8e1e44c16ff793 ] When one node leaves cluster or stops the resyncing (resync or recovery) array, then other nodes need to call recover_bitmaps to continue the unfinished task. But we need to clear suspend_area later after other nodes copy the resync information to their bitmap (by call bitmap_copy_from_slot). Otherwise, all nodes could write to the suspend_area even the suspend_area is not handled by any node, because area_resyncing returns 0 at the beginning of raid1_write_request. Which means one node could write suspend_area while another node is resyncing the same area, then data could be inconsistent. So let's clear suspend_area later to avoid above issue with the protection of bm lock. Also it is straightforward to clear suspend_area after nodes have copied the resync info to bitmap. Signed-off-by: Guoqing Jiang Reviewed-by: NeilBrown Signed-off-by: Shaohua Li Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- drivers/md/md-cluster.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -239,15 +239,6 @@ static void recover_bitmaps(struct md_th while (cinfo->recovery_map) { slot = fls64((u64)cinfo->recovery_map) - 1; - /* Clear suspend_area associated with the bitmap */ - spin_lock_irq(&cinfo->suspend_lock); - list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list) - if (slot == s->slot) { - list_del(&s->list); - kfree(s); - } - spin_unlock_irq(&cinfo->suspend_lock); - snprintf(str, 64, "bitmap%04d", slot); bm_lockres = lockres_init(mddev, str, NULL, 1); if (!bm_lockres) { @@ -266,6 +257,16 @@ static void recover_bitmaps(struct md_th pr_err("md-cluster: Could not copy data from bitmap %d\n", slot); goto dlm_unlock; } + + /* Clear suspend_area associated with the bitmap */ + spin_lock_irq(&cinfo->suspend_lock); + list_for_each_entry_safe(s, tmp, &cinfo->suspend_list, list) + if (slot == s->slot) { + list_del(&s->list); + kfree(s); + } + spin_unlock_irq(&cinfo->suspend_lock); + if (hi > 0) { /* TODO:Wait for current resync to get over */ set_bit(MD_RECOVERY_NEEDED, &mddev->recovery);