Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp3496891imm; Sun, 16 Sep 2018 20:25:36 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdb8bPDoII/JM/vUlXCgtouScD3SWG9U2scG5ByS3jJ6EpdNn9EeLEW2TY+T7NxeYUXuYyBC X-Received: by 2002:a17:902:b60b:: with SMTP id b11-v6mr22094255pls.301.1537154736248; Sun, 16 Sep 2018 20:25:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537154736; cv=none; d=google.com; s=arc-20160816; b=dbZd8/KYl0MYvA1AQbJappJEhnYAtAyxsXTZikHuKon+wA0B2YdguE439ewr8Z4J9Q Y6vDTAJKUXvh2nbEnBVe5Dd11SbvN4iDBHsA+WoJqMcX8/RZnxTGCWhAZK4U4MwEQCA+ C3UH0V3nNWa62Gc7VM48Q0o0MDcmIO33D3bRROc2RjxjX7E3m9JdzbdcIcvo6f7L4k9v ZBVU7Hlz3XPOCEqpamCTt4VJ7W9qBCW8snSf1Ow0rS4o3VAalESlp2qEUTsuUXbQn0/V tCMNsILhuEZcWJ3hYSSyioT/1sRQJ7RjjxHriS0jkux2AZa6JlViMYJsfjUQguYy/0XO PnXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=WAOVIozYlcg2+iicfNBxgngCrlUpCV3MPpnZ8GJazPA=; b=0xBkBqtuE6vnZfJd9R/5mXVGcSuTiFwUzZieTFXdLXxM7fIi4sPuAUXgz09hJlF2ZV TlKkOcQIJDpcXbhRSULdgEYIG+xKnTVvoB7inMb3VboSRRrSKdvEqntlkhjUvE1+hCfk kN86f0e+VOf+PsKmhbcVgj2fpP1qWs/bE4ZDhTA/z7HJw6Gxlq51rnK5w/HLccRtFmCx kIGO2RbFEiGamb+w/ATjTZ9ApJHryg6+bkkl4vYDGQR1LpwEFuBiEmbh/dnvIc1k/Als sub4vWVGIA6q7i9mWCc0o6i1hw+EXQ/jd/9Bg8KTUTnsdav4aWWn9hu7t3nqvBJV3Pk9 XdRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=fdoEeR0l; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z15-v6si13306658pga.117.2018.09.16.20.25.21; Sun, 16 Sep 2018 20:25:36 -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=@microsoft.com header.s=selector1 header.b=fdoEeR0l; 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=REJECT sp=REJECT dis=NONE) header.from=microsoft.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729966AbeIQI26 (ORCPT + 99 others); Mon, 17 Sep 2018 04:28:58 -0400 Received: from mail-eopbgr680131.outbound.protection.outlook.com ([40.107.68.131]:11025 "EHLO NAM04-BN3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729890AbeIQI24 (ORCPT ); Mon, 17 Sep 2018 04:28:56 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=WAOVIozYlcg2+iicfNBxgngCrlUpCV3MPpnZ8GJazPA=; b=fdoEeR0lqoWggggO9BkBAbYTBeMJ5GdaJtlF4c6NMUknEfTBzk0cEYWRskO4D4c20IiMGhUkSKQb5VxuTijXGXljjoX679l9BTUT6Qz+7EdFywAMAu2Xk3Kd+z8QBJISMCJnJjyY8KlwHJ9mgIJSQxm7edOpAdIrLm9BscjE3QA= Received: from CY4PR21MB0776.namprd21.prod.outlook.com (10.173.192.22) by CY4PR21MB0470.namprd21.prod.outlook.com (10.172.121.148) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.12; Mon, 17 Sep 2018 03:03:36 +0000 Received: from CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36]) by CY4PR21MB0776.namprd21.prod.outlook.com ([fe80::54e2:88e0:b622:b36%5]) with mapi id 15.20.1185.003; Mon, 17 Sep 2018 03:03:36 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Guoqing Jiang , Shaohua Li , Sasha Levin Subject: [PATCH AUTOSEL 4.14 19/87] md-cluster: clear another node's suspend_area after the copy is finished Thread-Topic: [PATCH AUTOSEL 4.14 19/87] md-cluster: clear another node's suspend_area after the copy is finished Thread-Index: AQHUTjLi2hb4CFkOq0W7UHYNEARdDw== Date: Mon, 17 Sep 2018 03:02:36 +0000 Message-ID: <20180917030220.245686-19-alexander.levin@microsoft.com> References: <20180917030220.245686-1-alexander.levin@microsoft.com> In-Reply-To: <20180917030220.245686-1-alexander.levin@microsoft.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [52.168.54.252] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;CY4PR21MB0470;6:igwUeyqWQc18O0o6sZ9MwOVy59hWIkTkMzk+6jPOhdK0fFThNq4sx//Wm+h800wSOSm/Ufi2NnipinxKfIw0RMQBAFIOaopwpLkwDKdqNPIY5qwBO0NuzIYOjEnTd4LWb+w7Eu6c+2N1tONNdny470Bc+GnE2KqB2ZCENne5NhbPZTOCxPtPXyD4rhzpfhhIPoS2YjWihyZgqeIUtriY1m78VuR7PIBRZmDONb5QbKTXl430KdhIK7552hl7XKWRxBQxh4VC4yM6YMlwntjShBYKnnauvSfsUsoyYCK9xAbSWbdNysIhWQArrPyLK6ofQbnt8M+c33wHfnH0h/Knp9nhCrI/cGlVOBLoM0kpWE5CqQH3PqB9g1JZ4KHeif5ZqVZtqXdLBh3RsGPamfVhMuEymcaWqg7WLG5X2367T0yUNpBkUSfpxN4JI8WvbqPLnssJqERfjBUu3G+p7Pjviw==;5:O1Ng1nAxCsfdg1+r5vmm5EHH8EaMkBmkeFhy6FyOfejRopagQsLFD6h7O2CEdEpQLVp234zCOjsQlHFo3C11fE3oQ898NNNYu1NFvAhrErU2hZ2FT1HrWsDLeGENjbWdmmEz/4wywzmUoSpAbYE1kGNLldo633fEHjLEjur994Y=;7:DycjCqoUHdCEjK9hVNeFXl24ltzunNdOJP7HBUiluuUnmgI1fRK8okcHvTl0nWWCGsHc5o0NyN1+jVJ4v4Lx8NDHVMwi3Esuc84/CUExaRzZLvcj+br9QX12WUUJDjb4yKnuymVZ1zpjwE6mRs18k5kr2fwaHTq1Yi9A6QyF0Fpgp1qfhgoewqkasccx7mtjMfIljNaZuSmw3N+12AzF+FyxYbKzdtWCEmeS/KBQi6mUa6W6unsZc7Dr77AzhgQ8 x-ms-office365-filtering-correlation-id: 7da422ac-5536-4c2e-9742-08d61c4a2926 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(7020095)(4652040)(8989137)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600074)(711020)(4618075)(2017052603328)(7193020);SRVR:CY4PR21MB0470; x-ms-traffictypediagnostic: CY4PR21MB0470: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(67672495146484)(28532068793085)(89211679590171); x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(10201501046)(3002001)(93006095)(93001095)(3231355)(944501410)(52105095)(2018427008)(6055026)(149027)(150027)(6041310)(20161123562045)(20161123564045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699050)(76991041);SRVR:CY4PR21MB0470;BCL:0;PCL:0;RULEID:;SRVR:CY4PR21MB0470; x-forefront-prvs: 0798146F16 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(376002)(346002)(39860400002)(366004)(136003)(189003)(199004)(15650500001)(1076002)(25786009)(4326008)(107886003)(5660300001)(3846002)(6116002)(54906003)(110136005)(22452003)(316002)(86612001)(76176011)(53936002)(6512007)(68736007)(7736002)(305945005)(86362001)(575784001)(2900100001)(256004)(66066001)(8936002)(11346002)(446003)(10290500003)(6486002)(14454004)(81156014)(486006)(6506007)(2501003)(99286004)(26005)(2906002)(10090500001)(478600001)(72206003)(105586002)(6436002)(102836004)(186003)(8676002)(2616005)(476003)(5250100002)(36756003)(81166006)(106356001)(6346003)(14444005)(97736004)(217873002);DIR:OUT;SFP:1102;SCL:1;SRVR:CY4PR21MB0470;H:CY4PR21MB0776.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-message-info: Z+QJEoZ0lX0pwNWPRKNDUQvlAya5a1mkLx0VUQmKTsOf8FMoVnIbNHwrxnJrrkDy2Qa7A7XHoHEXjIqI48N+AlTHhzVzOYCSc9ql2Y4ltYF1aUYXwwIxCSH6mcL2N7zVN+ntbA+TtCpmTw1dAbcfJqcTADIflgtOhwcFYvY9ixaW2f2Np00oIMadbzbQcfq3mvIzL6RavjkyF3ISY8g465ZO0wAB/qXUV9op1XvWPEoHVCRvKGieg0mw4E10q9Ih/YaYaTUZl47hryqc8P29sKwn1NcVKVcVJ0ChuiLDnzNu0jhUIxk4FQx6KdaW8uz9RzIc53RKsvnUdsP25hxg/oCEaLmSxHY1x1VQMcjx3z8= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: microsoft.com X-MS-Exchange-CrossTenant-Network-Message-Id: 7da422ac-5536-4c2e-9742-08d61c4a2926 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Sep 2018 03:02:36.1969 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY4PR21MB0470 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- drivers/md/md-cluster.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/md/md-cluster.c b/drivers/md/md-cluster.c index 72ce0bccc865..717aaffc227d 100644 --- a/drivers/md/md-cluster.c +++ b/drivers/md/md-cluster.c @@ -304,15 +304,6 @@ static void recover_bitmaps(struct md_thread *thread) while (cinfo->recovery_map) { slot =3D fls64((u64)cinfo->recovery_map) - 1; =20 - /* 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 =3D=3D s->slot) { - list_del(&s->list); - kfree(s); - } - spin_unlock_irq(&cinfo->suspend_lock); - snprintf(str, 64, "bitmap%04d", slot); bm_lockres =3D lockres_init(mddev, str, NULL, 1); if (!bm_lockres) { @@ -331,6 +322,16 @@ static void recover_bitmaps(struct md_thread *thread) pr_err("md-cluster: Could not copy data from bitmap %d\n", slot); goto clear_bit; } + + /* 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 =3D=3D s->slot) { + list_del(&s->list); + kfree(s); + } + spin_unlock_irq(&cinfo->suspend_lock); + if (hi > 0) { if (lo < mddev->recovery_cp) mddev->recovery_cp =3D lo; --=20 2.17.1