Received: by 10.213.65.68 with SMTP id h4csp2115548imn; Sun, 8 Apr 2018 20:06:11 -0700 (PDT) X-Google-Smtp-Source: AIpwx4992TTtxMe133TySh2fmPSsAv0EeGmwf80fwjd6MMLUnGnKiB/+aMZOyPQ7f+ZPNC5yQ8No X-Received: by 10.98.201.15 with SMTP id k15mr27681758pfg.184.1523243171136; Sun, 08 Apr 2018 20:06:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523243171; cv=none; d=google.com; s=arc-20160816; b=QvbAYjSzJ9LiBYmjYxDestIRKcgjwrNsTrYftASGIGcDHJY+Cg78DMgH5lQP3IJlPb XpYdBc3QyW7HzzMjQTEIQpEgeSLxcRmRVF+dMmBZHzCVKNZucraLRFNi1L/DDB0XPcP6 e734TdlBA/ii/YQlxEUwCClRxI0BEdwWYgmjQdZ4qObaqMRlXthe2YSEcZL2qdML7f2/ Qoj/Cl7dqCHebA1skndgCu6XiM2z0Nz5LFhJQs0eIw25vbnq8Mp5TBB6QNQxuVau/FG0 dkPOcCS2oVWvxb7j/3fnep5oJtNIgdZ1P44ngOukpKTlE0rtoIFSyQHxV7n11VRLNx5z hcyw== 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=7VWd73XQpBQDu/EVJWwpqc+rCfDc+OUElosnKci1iHA=; b=T3AXTLFSHng5bU25PBYaZGtDHxHQ0HQTwAgwZITLX3CbO0wdiRQkWkQXf4bTQd4LeB fQoQxAFpaurC3QnI1hyjtQVctaa6MFYM1jY2Eds8OmmYjdmjUXiy/G+bMWE0FrcCcCGC Rwl5+2DMIVVQyFnNGO6gMwV6bkFxxZ5sRAYK7jmBlCspr8w9RH5wvjmxJLhv8k6MXvvL RmYfF+3T+Fw0UToXwKwquNJ1BRJmY2GESMOHR5g+PDKRmA1LT3bxGfPX8YgN991ejRFW PRptxx1H6NpvFli0bpTwNKEH/EI75vCp9rRW+oBOx40f5dzrxDDxpP1LZYY5IBsVqdW5 OEuw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@microsoft.com header.s=selector1 header.b=gtw41OrS; 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 p86si10026384pfi.223.2018.04.08.20.05.34; Sun, 08 Apr 2018 20:06:11 -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=gtw41OrS; 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 S1755967AbeDIA3R (ORCPT + 99 others); Sun, 8 Apr 2018 20:29:17 -0400 Received: from mail-by2nam03on0120.outbound.protection.outlook.com ([104.47.42.120]:61603 "EHLO NAM03-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754269AbeDIA3K (ORCPT ); Sun, 8 Apr 2018 20:29:10 -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=7VWd73XQpBQDu/EVJWwpqc+rCfDc+OUElosnKci1iHA=; b=gtw41OrSKJaUYa5F8idISGbIQk/MZhzOTegB4mAaRiQK6aZpYeBfGBo1+LfSUoIodMVfsr2qvnLY8ko0jadI2B89kYZFKZoX4szCIZkGJD/+UPEwekabGhmkUqFx2HSmDmMJRFDFv7lRHkk2Ks1dlK3N2w4WLtxd6V6qksfCBc0= Received: from DM5PR2101MB1032.namprd21.prod.outlook.com (52.132.128.13) by DM5PR2101MB0967.namprd21.prod.outlook.com (52.132.133.25) 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:29:08 +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:29:08 +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.9 093/293] Btrfs: tolerate errors if we have retried successfully Thread-Topic: [PATCH AUTOSEL for 4.9 093/293] Btrfs: tolerate errors if we have retried successfully Thread-Index: AQHTz5kSX3tmU6dfYUOkJ9KDKtoXoQ== Date: Mon, 9 Apr 2018 00:24:06 +0000 Message-ID: <20180409002239.163177-93-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;DM5PR2101MB0967;7:irv8cls0BHTnFOMYCz6YY4er8xdrSgJ+T3xs7oJTZogUT0OTMt+cpjOcPmPxBlPqhaGZkqIX6b7rwg0oPtWq+H+LXBq/cpd0IdWoMWM0KVP8tz4i/BBpWKOReuFdtyzeoDXPs6AROyHScsZeGKH8iz/+PyFW7YDci3GGCMfsBIdzaje7XKqyJbl9Ft8daQZEPCk2yQzbd2OrvZn6Uz2952t99lg9GB7ytJ3UOcUrIkFYI5DPcGrEMc5aVtOV7WDo;20:Kyae2uQAivZaOT7Q0Agz4rEC1hZ7N1r9EkNohGuIBXNc8wyNGxipxYE/Uh7PX3qV558nWLYSs54/FQ6kRfRkrXnKwb5SOmfRvFxEiyLMSe29mTR47rBVqXtHn6d5m04+3niX6USthqcPoFn7Q4wKvpUjdmsylTkujpVJCp/MdBI= x-ms-office365-filtering-ht: Tenant X-MS-Office365-Filtering-Correlation-Id: 0061c55d-07f0-4689-5eac-08d59db0e8d6 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(7020095)(4652020)(48565401081)(5600026)(4604075)(3008032)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7193020);SRVR:DM5PR2101MB0967; x-ms-traffictypediagnostic: DM5PR2101MB0967: 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)(5005006)(8121501046)(93006095)(93001095)(3231221)(944501327)(52105095)(3002001)(10201501046)(6055026)(61426038)(61427038)(6041310)(20161123558120)(20161123562045)(20161123560045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011);SRVR:DM5PR2101MB0967;BCL:0;PCL:0;RULEID:;SRVR:DM5PR2101MB0967; x-forefront-prvs: 0637FCE711 x-forefront-antispam-report: SFV:NSPM;SFS:(10019020)(396003)(39860400002)(366004)(376002)(39380400002)(346002)(199004)(189003)(6506007)(486006)(86362001)(14454004)(59450400001)(68736007)(102836004)(99286004)(26005)(3846002)(6116002)(186003)(476003)(2616005)(1076002)(3280700002)(86612001)(72206003)(4326008)(446003)(54906003)(76176011)(11346002)(2906002)(22452003)(3660700001)(110136005)(97736004)(316002)(5660300001)(478600001)(8676002)(6512007)(8936002)(107886003)(6486002)(53936002)(81166006)(36756003)(81156014)(10290500003)(6436002)(10090500001)(25786009)(66066001)(106356001)(305945005)(7736002)(2501003)(5250100002)(105586002)(2900100001)(22906009)(217873001);DIR:OUT;SFP:1102;SCL:1;SRVR:DM5PR2101MB0967;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: WQRhQGiuvgdqOXqrfG0m4g5ZFskQxNDGKH7AzIKVgbAU6UTiUfJ5/9dkUS7sqbOdJJHLmANiVuipdXk5CYNO09pfjtdN5dquzDHmRDUhSzN/pNIXV9zC5hsEpAw4AmnXdicwVvz2mx+hz6HxYjsXS43TynG2q1v99McAIj6s6ZM5KpG4GGyT9NoTTSVQmB9fVf3ehuo5CgS72k+BgNVZib2OIhNzpVTTtV+dXLd1ahP2OJGpw8ElLKnyPKbX0v7+HiZCBct/HglAw9MfndFvmpmNNRqwd32gIcfBzh4xatKZAaPpsdeIrd0c9TDhwX7yD7iWJCOglDWg8vkiqy+Mmpmg/nEVPpLh3GM8zfo3yAgT0ZQWntwiylKc+VHIAQZ8ZLuVw2XT1thFVKAhx6wHjLRGCFoUo1eYma+kVoi7a94= 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: 0061c55d-07f0-4689-5eac-08d59db0e8d6 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Apr 2018 00:24:06.6593 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 72f988bf-86f1-41af-91ab-2d7cd011db47 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM5PR2101MB0967 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 ffd5831ca15c..389ffaff72bf 100644 --- a/fs/btrfs/inode.c +++ b/fs/btrfs/inode.c @@ -8219,8 +8219,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