Return-Path: Received: from mail-bl2nam02on0101.outbound.protection.outlook.com ([104.47.38.101]:39744 "EHLO NAM02-BL2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S965125AbeCSP7h (ORCPT ); Mon, 19 Mar 2018 11:59:37 -0400 From: Sasha Levin To: "linux-kernel@vger.kernel.org" , "stable@vger.kernel.org" CC: Colin Ian King , David Sterba , Sasha Levin Subject: [PATCH AUTOSEL for 4.9 059/281] btrfs: fix incorrect error return ret being passed to mapping_set_error Date: Mon, 19 Mar 2018 15:58:59 +0000 Message-ID: <20180319155742.13731-59-alexander.levin@microsoft.com> References: <20180319155742.13731-1-alexander.levin@microsoft.com> In-Reply-To: <20180319155742.13731-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Colin Ian King [ Upstream commit bff5baf8aa37a97293725a16c03f49872249c07e ] The setting of return code ret should be based on the error code passed into function end_extent_writepage and not on ret. Thanks to Liu Bo for spotting this mistake in the original fix I submitted. Detected by CoverityScan, CID#1414312 ("Logically dead code") Fixes: 5dca6eea91653e ("Btrfs: mark mapping with error flag to report error= s to userspace") Signed-off-by: Colin Ian King Reviewed-by: Liu Bo Signed-off-by: David Sterba Signed-off-by: Sasha Levin --- fs/btrfs/extent_io.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index 8ed05d95584a..03ac3ab4b3b4 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c @@ -2453,7 +2453,7 @@ void end_extent_writepage(struct page *page, int err,= u64 start, u64 end) if (!uptodate) { ClearPageUptodate(page); SetPageError(page); - ret =3D ret < 0 ? ret : -EIO; + ret =3D err < 0 ? err : -EIO; mapping_set_error(page->mapping, ret); } } --=20 2.14.1