From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755605AbcEQBbg (ORCPT ); Mon, 16 May 2016 21:31:36 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34447 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932573AbcEQB1G (ORCPT ); Mon, 16 May 2016 21:27:06 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Lyakas , Filipe Manana , David Sterba Subject: [PATCH 4.5 094/101] btrfs: csum_tree_block: return proper errno value Date: Mon, 16 May 2016 18:21:39 -0700 Message-Id: <20160517011510.155740576@linuxfoundation.org> X-Mailer: git-send-email 2.8.2 In-Reply-To: <20160517011506.359924439@linuxfoundation.org> References: <20160517011506.359924439@linuxfoundation.org> User-Agent: quilt/0.64 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.5-stable review patch. If anyone has any objections, please let me know. ------------------ From: Alex Lyakas commit 8bd98f0e6bf792e8fa7c3fed709321ad42ba8d2e upstream. Signed-off-by: Alex Lyakas Reviewed-by: Filipe Manana Signed-off-by: David Sterba Signed-off-by: Greg Kroah-Hartman --- fs/btrfs/disk-io.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -303,7 +303,7 @@ static int csum_tree_block(struct btrfs_ err = map_private_extent_buffer(buf, offset, 32, &kaddr, &map_start, &map_len); if (err) - return 1; + return err; cur_len = min(len, map_len - (offset - map_start)); crc = btrfs_csum_data(kaddr + offset - map_start, crc, cur_len); @@ -313,7 +313,7 @@ static int csum_tree_block(struct btrfs_ if (csum_size > sizeof(inline_result)) { result = kzalloc(csum_size, GFP_NOFS); if (!result) - return 1; + return -ENOMEM; } else { result = (char *)&inline_result; } @@ -334,7 +334,7 @@ static int csum_tree_block(struct btrfs_ val, found, btrfs_header_level(buf)); if (result != (char *)&inline_result) kfree(result); - return 1; + return -EUCLEAN; } } else { write_extent_buffer(buf, result, 0, csum_size); @@ -516,8 +516,7 @@ static int csum_dirty_buffer(struct btrf found_start = btrfs_header_bytenr(eb); if (WARN_ON(found_start != start || !PageUptodate(page))) return 0; - csum_tree_block(fs_info, eb, 0); - return 0; + return csum_tree_block(fs_info, eb, 0); } static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, @@ -660,10 +659,8 @@ static int btree_readpage_end_io_hook(st eb, found_level); ret = csum_tree_block(root->fs_info, eb, 1); - if (ret) { - ret = -EIO; + if (ret) goto err; - } /* * If this is a leaf block and it is corrupt, set the corrupt bit so