Received: by 10.213.65.68 with SMTP id h4csp2116392imn; Sun, 8 Apr 2018 20:07:15 -0700 (PDT) X-Google-Smtp-Source: AIpwx49FiPSshECdPCds1ux565UX1K5lSGyQ7Rr80juio1ldV+XlccbPFatPEFKOQ7TpxlQrX5da X-Received: by 2002:a17:902:a589:: with SMTP id az9-v6mr36619746plb.283.1523243235817; Sun, 08 Apr 2018 20:07:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243235; cv=none; d=google.com; s=arc-20160816; b=gELHImThbNnO7jt3XPW2fL5sEEeT6kXgNGWeXsr+KxrNtF2W5DxuIfvICeehIwqSO9 wXTnay6VR3iJmH3Jpa5EjWjqI416plFlAJQeUNxXXplSXF0zssB4GMPRwJbrOKugPsLa LHVKAYVYsN6cTVT91+r8eVQ5EP6JNThaAw4aWjxo9tuH+1SqTrE/ttaCSULlQJEM7LGQ NBFa2uYhwTbOjIiNty6t0Z6zZk6DAeVFHaJXa/dfG7YbMK4Pq+BhNtsFPHtJu6gCssIX HQKM/7nzuTtYEdMNmWxR+TOAWGjk+pxZHG7x/txtBeRXVLA85rpKHfbTMEEr22zytbhZ uYXw== 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=zAWPdJFTaCbJUo81T7tU236lyFMLu6S1VTV/jN+Uc6k=; b=AGKYmx3polugfIzQHq+8tS0NzVIRbNMjK6tlur71YcZCNkt1O0ebJWmIVkmAVwAVUH w5ATEFCp5CK5QQmDzuxBC3IgXm1qLrBMB/5LwuyPL00EvcmGrsjzkufjWbbjFHCEVKbA DR8b/IZJBGtkIiGr0yQu1CFV1DFhM1v3ruru6AyxmVDKnEh7INVeb3bgu4onBBMpfqZp rmN9tOatsEOZBwTuLUE1HTY8fDLsN8MdXQFV1N8yi15cRytOcaDVufxGEuZumeLRenY1 D+qsOMJEvfo++q0m7TvbUwwY0bozMC/TIIcZGT4soOvplGGNXRnTj8bxz2nE0dnS7Fs4 J0Vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=VkytXdFW; 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 o14si8366506pgn.36.2018.04.08.20.06.39; Sun, 08 Apr 2018 20:07:15 -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=VkytXdFW; 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 S1756681AbeDIAgG (ORCPT + 99 others); Sun, 8 Apr 2018 20:36:06 -0400 Received: from mail-cys01nam02on0100.outbound.protection.outlook.com ([104.47.37.100]:40736 "EHLO NAM02-CY1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756640AbeDIAf7 (ORCPT ); Sun, 8 Apr 2018 20:35:59 -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=zAWPdJFTaCbJUo81T7tU236lyFMLu6S1VTV/jN+Uc6k=; b=VkytXdFWNDodRi2ZH7Db/3xhv6LSqYoz94t0SQDCvXCOinOLB69vrv3DJFuEtbPAk3PxbynaqLPcktmgaoNGnKMwVkA84SktCfYrnLNFQtD7QLQwizi77usE26pwi5XFC12EngXn8hg3SCyfipV4N4FdjtrfkCMufou6/VB9Rp0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB1015.namprd21.prod.outlook.com (52.132.133.37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.696.0; Mon, 9 Apr 2018 00:35:57 +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:35:57 +0000 From: Sasha Levin To: "stable@vger.kernel.org" , "linux-kernel@vger.kernel.org" CC: Liu Bo , David Sterba , Sasha Levin Subject: [PATCH AUTOSEL for 4.4 047/162] Btrfs: tolerate errors if we have retried successfully Thread-Topic: [PATCH AUTOSEL for 4.4 047/162] Btrfs: tolerate errors if we have retried successfully Thread-Index: AQHTz5mnLhKcxHuwAEyYpE+J93iSMw== Date: Mon, 9 Apr 2018 00:28:16 +0000 Message-ID: <20180409002738.163941-47-alexander.levin@microsoft.com> References: <20180409002738.163941-1-alexander.levin@microsoft.com> In-Reply-To: <20180409002738.163941-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;DM5PR2101MB1015;7:4kGB3dhUOsJT1C57hUkmJOmau7HSVkwS8FgvlynrkyRD8slCCF3WzNYFtzLEPKyAWBvoWFOSmOc+KyzhIRxSS2tATtGohWtkZVhAyiyyZYZzI+kdfd9Bn8/Kp2J3J8u5GfX6Qyq8e+/RF4ZoaOYoG126V3pi+edi4ASMWOe+4HtKmvRprY3j7dgS+B1M4ltP92uadiz9EX1Ia3RpOWuVX2c9eA4HOVtEIEjKq0xYRQLSUBUkvLvqV7cOS7jL1duc;20:yQi7tbCy6T1VKApXsNbK2XJNUptDC6Zn8OTCidcKc8TTJSW/eE/AOn0e1g9AOMP0700gUblLyCvAIfS4DTMSYzFPwTClCa+oDM6tOQGw10Vg7U2OndA0qyO3Q7Mi/rd4xCMgeknwPmhT6QEhBT1cACIs2HZw6YNExRIhg/lBAgg= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 4217b334-3471-43a7-c52b-08d59db1dc69 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB1015; x-ms-traffictypediagnostic: DM5PR2101MB1015: 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)(146099531331640); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(61425038)(6040522)(2401047)(8121501046)(5005006)(3231221)(944501327)(52105095)(3002001)(93006095)(93001095)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123560045)(20161123564045)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(6072148)(201708071742011);SRVR:DM5PR2101MB1015;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB1015; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(39380400002)(376002)(346002)(366004)(189003)(199004)(53936002)(4326008)(478600001)(72206003)(3280700002)(2616005)(14454004)(305945005)(5250100002)(3660700001)(2501003)(2900100001)(54906003)(110136005)(86362001)(1076002)(107886003)(6506007)(36756003)(446003)(68736007)(6512007)(7736002)(486006)(2906002)(5660300001)(6436002)(3846002)(86612001)(6486002)(66066001)(11346002)(476003)(6666003)(59450400001)(26005)(10090500001)(316002)(22452003)(8676002)(81156014)(81166006)(6116002)(105586002)(99286004)(186003)(106356001)(76176011)(25786009)(97736004)(10290500003)(102836004)(8936002)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB1015;H:DM5PR2101MB1032.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) x-microsoft-antispam-message-info: kbPvQiUj9h5Fod5OYdRLiHsN3oJX7Ypu6y3YPtq0nwmeqnX4uGaiRFMaPpGqk5gdbOIr+fsP/QVUxA1pKheS41yBGarGe9qcCtwVJtH6K/hoMHV5+JpdF4lmP/lt1OSEUjxlJp5f4e+3v3CyFnOAHAXcI9sCzK0KYFiED7F8T26uOMQuGJ3zyFU1BSo3TNNq60DMag4qH0PGRzUdICcrKJNskd6/VANE+KCGkb+lIkf07EvkGHIpvgjWfvTSoM7QSHx5lqREe2kqPY7bMlVYvbp+YT25KxsvVjBazvC/W8I50PVKu33mL2jSw8JYVUWfuO44NfEo4Nb2d9+NlznJuz3IiW6fmHaNWcKjn5NXJf1PzlPNNncQRhYn+9hPYDgYUndIvZQFvuRPZLUF6v4CPTNLyHqUPlLsxWgoXa7Q5zU= 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: 4217b334-3471-43a7-c52b-08d59db1dc69 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:28:16.6299 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB1015 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Liu Bo [ Upstream commit e3d37faba2eb19a1d459917bbf54ac1c65711510 ] With raid1 profile, dio read isn't tolerating IO errors if read length is less than the stripe length (64K). Our bio didn't get split in btrfs_submit_direct_hook() if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) is true and that happens when the read length is less than 64k. In this case, if the underlying device returns error somehow, bio->bi_error has recorded that error. If we could recover the correct data from another copy in profile raid1/10/= 5/6, with btrfs_subio_endio_read() returning 0, bio would have the correct data = in its vector, but bio->bi_error is not updated accordingly so that the follow= ing dio_end_io(dio_bio, bio->bi_error) makes directIO think this read has faile= d. This fixes the problem by setting bio's error to 0 if a good copy has been found. Signed-off-by: Liu Bo Reviewed-by: David Sterba Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/inode.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c index 81b5a461d94e..d56520e52dce 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8029,8 +8029,11 @@ static void btrfs_endio_direct_read(struct bio *bio) struct btrfs_io_bio *io_bio =3D btrfs_io_bio(bio); int err =3D bio->bi_error; =20 - if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) + if (dip->flags & BTRFS_DIO_ORIG_BIO_SUBMITTED) { err =3D btrfs_subio_endio_read(inode, io_bio, err); + if (!err) + bio->bi_error =3D 0; + } =20 unlock_extent(&BTRFS_I(inode)->io_tree, dip->logical_offset, dip->logical_offset + dip->bytes - 1); --=20 2.15.1