Received: by 10.213.65.68 with SMTP id h4csp2118093imn; Sun, 8 Apr 2018 20:09:19 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Egv+TdrJtXBJYRBOmxFT5oT7UMc3nawX+0Ly1s/INAJEMDwdj6QD/BmjXM0c+3plSkLBz X-Received: by 2002:a17:902:822:: with SMTP id 31-v6mr37784508plk.200.1523243359569; Sun, 08 Apr 2018 20:09:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243359; cv=none; d=google.com; s=arc-20160816; b=L34w2YHC6r6y6bXOw99WDMxk1s8kH0bV/bmz1N9LWKHruMgQhhpVOBIb7X87pFjZDz cftEIUMxjoPoge5bDVJc/BEi9TZO/01qbuZ0z2G/v3MXmzT/Ookw47rpNW7PzAVc4UyG og+EKObo0cnUi6yjGEE5Rxhj56LzMhNzAmQFc3oDF8U5t0TLJFJLVfTjzFAKjNeCBVWu hn5HGNlkBb787xVvImOYgBLKs1YxQsoqWr1/swjGNaVXBZ+kE49+gOtXy6zNh3haKz7R Dnco37PbZ7IT4s1PeR6uagV+oZvCT5lvAd5osEv/e0VVPfig0SWkSIVpyVzuUupdzEvD ZlLg== 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 :arc-authentication-results; bh=zsSgVKpeT/dy6fwxWOuZwP25S9y74kRVeGJwtcSBPL0=; b=a8hYEN7w0KNJcTy4p3GRCB39WT4DNZJIk+plIRtS5+tfgomNbilPwyD6a5w9z/FX2c FnaR2mkO9D/ex9snXkI4OgmtRL6xutSsxnthIX83PglOKy/8EXBieoEJRHQVVoerQBA/ 2XU7OFBNocNQLEpbp4+4/EAhL/bAfvCvc2i7n5kAo/RbAZ3pU7ghxjmODBCMAomLMOdI lF2WKJcQ+AiUahgb2QCugtCcmSc0hLPaLvT+2ypbwDueysG3P1L37BYqEPy+GMWKFRMz foeWTb9uW9nDT4zJu11IRQoKnNUtY1k54hzltsbX71pFFxu5e4rr0YMN9mAKnKadmnTd BDCg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=YYNC0I8+; 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 94-v6si13736013ple.56.2018.04.08.20.08.42; Sun, 08 Apr 2018 20:09:19 -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=YYNC0I8+; 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 S1757789AbeDIC3B (ORCPT + 99 others); Sun, 8 Apr 2018 22:29:01 -0400 Received: from mail-dm3nam03on0110.outbound.protection.outlook.com ([104.47.41.110]:12595 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754313AbeDIA2h (ORCPT ); Sun, 8 Apr 2018 20:28:37 -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; bh=zsSgVKpeT/dy6fwxWOuZwP25S9y74kRVeGJwtcSBPL0=; b=YYNC0I8+a7mQbHklrvMLLZiCA81iM98XxiFg0tfffoD/y0Y1bTGgv4gs5/504a1uKMfICWTFCePCR9KR2oAqw7CU7vNbEE7JKzu4TntctpI1AUoXr9uA1qRxVdDBWG9QZ6STD8CYYz9rDki3tzthvHN9YsQBP+BqlY/tAZIUHno= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0807.namprd21.prod.outlook.com (10.167.110.154) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.3; Mon, 9 Apr 2018 00:28:31 +0000 Received: from DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059]) by DM5PR2101MB1032.namprd21.prod.outlook.com ([fe80::8109:aef0:a777:7059%2]) with mapi id 15.20.0696.003; Mon, 9 Apr 2018 00:28:31 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Mike Snitzer , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 080/293] Revert "dm mirror: use all available legs on multiple failures" Thread-Topic: [PATCH AUTOSEL for 4.9 080/293] Revert "dm mirror: use all available legs on multiple failures" Thread-Index: AQHTz5kMD1+1agiVSUWdZLWCnwGFRw== Date: Mon, 9 Apr 2018 00:23:56 +0000 Message-ID: <20180409002239.163177-80-alexander.levin@microsoft.com> References: <20180409002239.163177-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002239.163177-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;DM5PR2101MB0807;7:ZOuuJEIkuf9hJrL9BdYAIrsczQGF6XEEWZhzqopOyC2ZJVw54aaBbpWm08eoS4J8+aj5dRYYc6bU54jwAgw8sWHb/RO5/rR1XaYQaZ0UPk48SU5c5/svscWae2TvtP3dqhSbpVpjsZ48jrOIOga3CZVWFzcLD9M4t1YCTmCA1OZSoZv7g0ho8ZsSIIpzyd0A2mmA9eLQoNWTQoHQejt/GDyq07OTYWNNMchRCh+CtiacfDSlJqDOlRJM1nmVciBc;20:XAP9uQUUWa4vlyARpn9eRXdivWofpWAig2OJBMHKEws4KxR8ytRTNe46UdiLBrbHT1/fmtWIR45RnahEaA9OF4guuZ+mz1XzURZoFRGPolYbHRsUQ+RBDsJzA6y0mYH88RQ/5IkhVyxHZDBnKNWh0ACVqttRA9t/gcC4Y+2OeXg= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 781aecbc-8638-43ea-bb6b-08d59db0d272 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0807; x-ms-traffictypediagnostic: DM5PR2101MB0807: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alexander.Levin@microsoft.com; x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(28532068793085)(89211679590171); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3231221)(944501327)(52105095)(3002001)(6055026)(61426038)(61427038)(6041310)(20161123562045)(20161123558120)(20161123564045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB0807;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0807; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(39380400002)(39860400002)(396003)(366004)(376002)(346002)(199004)(189003)(14454004)(4326008)(54906003)(25786009)(53936002)(2900100001)(1076002)(3280700002)(6486002)(186003)(2616005)(68736007)(110136005)(11346002)(10090500001)(6116002)(107886003)(3846002)(36756003)(8676002)(72206003)(22452003)(66066001)(26005)(6512007)(478600001)(3660700001)(81156014)(86362001)(81166006)(86612001)(7736002)(305945005)(8936002)(10290500003)(6436002)(105586002)(6666003)(316002)(59450400001)(76176011)(5660300001)(476003)(106356001)(2906002)(6506007)(446003)(2501003)(99286004)(5250100002)(486006)(102836004)(97736004)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0807;H:DM5PR2101MB1032.namprd21.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1;MX:1; received-spf: None (protection.outlook.com: microsoft.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: WeQ2TIn0k6CzMQXftJOoyVI9d4k5vGw9fqT7zlhtIQTXO+zepCDO4fRqLDyaO2xKHBsC9lUZnU5UxnJ4+OnDzGk5HUzCT2gjHgjI1mMvPAiw5aagyu4VMcqObzRS17FqlwinkykEyUNuFM5PGkTHprwRrBYHi4C3yg2fOFO4k2a7i0WlSRazfP3ikBU7tGs/VyruisLwHvRXd8fbJVcntTzq4zqHtdh78WiDSznE0SdWjND/WUOFBWpxJbuk6L85IUDpVOM5pCh4MHNr8RSD7p07wXjflom8887/JkmAapUn6bWMnLVWKLUxWwk3FxmknaX9tyBh/sFlJ1bXAG6fozR/C76WmyglW7VzKDxTQzEScj62C/k89CmoQeu9iMcgnUd7styDQnQYLIqKtdcsz4lGWzOoPmSM+3gASrg6xNE= 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: 781aecbc-8638-43ea-bb6b-08d59db0d272 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:23:56.7531 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0807 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Snitzer [ Upstream commit cd15fb64ee56192760ad5c1e2ad97a65e735b18b ] This reverts commit 12a7cf5ba6c776a2621d8972c7d42e8d3d959d20. This commit apparently attempted to fix an issue that didn't really exist, furthermore: this commit is the source of deadlocks and crashes seen in multiple cases related to failing the primary mirror dev while syncing. Reported-by: Jonathan Brassow Signed-off-by: Mike Snitzer Signed-off-by: Sasha Levin --- drivers/md/dm-raid1.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/md/dm-raid1.c b/drivers/md/dm-raid1.c index 9a8b71067c6e..7a6254d54baf 100644 --- a/drivers/md/dm-raid1.c +++ b/drivers/md/dm-raid1.c @@ -145,6 +145,7 @@ static void dispatch_bios(void *context, struct bio_lis= t *bio_list) =20 struct dm_raid1_bio_record { struct mirror *m; + /* if details->bi_bdev =3D=3D NULL, details were not saved */ struct dm_bio_details details; region_t write_region; }; @@ -1199,6 +1200,8 @@ static int mirror_map(struct dm_target *ti, struct bi= o *bio) struct dm_raid1_bio_record *bio_record =3D dm_per_bio_data(bio, sizeof(struct dm_raid1_bio_record)); =20 + bio_record->details.bi_bdev =3D NULL; + if (rw =3D=3D WRITE) { /* Save region for mirror_end_io() handler */ bio_record->write_region =3D dm_rh_bio_to_region(ms->rh, bio); @@ -1257,12 +1260,22 @@ static int mirror_end_io(struct dm_target *ti, stru= ct bio *bio, int error) } =20 if (error =3D=3D -EOPNOTSUPP) - return error; + goto out; =20 if ((error =3D=3D -EWOULDBLOCK) && (bio->bi_opf & REQ_RAHEAD)) - return error; + goto out; =20 if (unlikely(error)) { + if (!bio_record->details.bi_bdev) { + /* + * There wasn't enough memory to record necessary + * information for a retry or there was no other + * mirror in-sync. + */ + DMERR_LIMIT("Mirror read failed."); + return -EIO; + } + m =3D bio_record->m; =20 DMERR("Mirror read failed from %s. Trying alternative device.", @@ -1278,6 +1291,7 @@ static int mirror_end_io(struct dm_target *ti, struct= bio *bio, int error) bd =3D &bio_record->details; =20 dm_bio_restore(bd, bio); + bio_record->details.bi_bdev =3D NULL; bio->bi_error =3D 0; =20 queue_bio(ms, bio, rw); @@ -1286,6 +1300,9 @@ static int mirror_end_io(struct dm_target *ti, struct= bio *bio, int error) DMERR("All replicated volumes dead, failing I/O"); } =20 +out: + bio_record->details.bi_bdev =3D NULL; + return error; } =20 --=20 2.15.1