diff options
author | Alex Lyakas <alex.bolshoy@gmail.com> | 2016-03-10 06:09:46 -0500 |
---|---|---|
committer | David Sterba <dsterba@suse.com> | 2016-03-22 05:07:43 -0400 |
commit | 8bd98f0e6bf792e8fa7c3fed709321ad42ba8d2e (patch) | |
tree | 08a834dc29f1312f69671fa24527135c656a8bf1 /fs/btrfs/disk-io.c | |
parent | 5e33a2bd7ca7fa687fb0965869196eea6815d1f3 (diff) |
btrfs: csum_tree_block: return proper errno value
Signed-off-by: Alex Lyakas <alex@zadarastorage.com>
Reviewed-by: Filipe Manana <fdmanana@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
Diffstat (limited to 'fs/btrfs/disk-io.c')
-rw-r--r-- | fs/btrfs/disk-io.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index a998ef15ec6d..9cafae5c2061 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -302,7 +302,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, | |||
302 | err = map_private_extent_buffer(buf, offset, 32, | 302 | err = map_private_extent_buffer(buf, offset, 32, |
303 | &kaddr, &map_start, &map_len); | 303 | &kaddr, &map_start, &map_len); |
304 | if (err) | 304 | if (err) |
305 | return 1; | 305 | return err; |
306 | cur_len = min(len, map_len - (offset - map_start)); | 306 | cur_len = min(len, map_len - (offset - map_start)); |
307 | crc = btrfs_csum_data(kaddr + offset - map_start, | 307 | crc = btrfs_csum_data(kaddr + offset - map_start, |
308 | crc, cur_len); | 308 | crc, cur_len); |
@@ -312,7 +312,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, | |||
312 | if (csum_size > sizeof(inline_result)) { | 312 | if (csum_size > sizeof(inline_result)) { |
313 | result = kzalloc(csum_size, GFP_NOFS); | 313 | result = kzalloc(csum_size, GFP_NOFS); |
314 | if (!result) | 314 | if (!result) |
315 | return 1; | 315 | return -ENOMEM; |
316 | } else { | 316 | } else { |
317 | result = (char *)&inline_result; | 317 | result = (char *)&inline_result; |
318 | } | 318 | } |
@@ -333,7 +333,7 @@ static int csum_tree_block(struct btrfs_fs_info *fs_info, | |||
333 | val, found, btrfs_header_level(buf)); | 333 | val, found, btrfs_header_level(buf)); |
334 | if (result != (char *)&inline_result) | 334 | if (result != (char *)&inline_result) |
335 | kfree(result); | 335 | kfree(result); |
336 | return 1; | 336 | return -EUCLEAN; |
337 | } | 337 | } |
338 | } else { | 338 | } else { |
339 | write_extent_buffer(buf, result, 0, csum_size); | 339 | write_extent_buffer(buf, result, 0, csum_size); |
@@ -515,8 +515,7 @@ static int csum_dirty_buffer(struct btrfs_fs_info *fs_info, struct page *page) | |||
515 | found_start = btrfs_header_bytenr(eb); | 515 | found_start = btrfs_header_bytenr(eb); |
516 | if (WARN_ON(found_start != start || !PageUptodate(page))) | 516 | if (WARN_ON(found_start != start || !PageUptodate(page))) |
517 | return 0; | 517 | return 0; |
518 | csum_tree_block(fs_info, eb, 0); | 518 | return csum_tree_block(fs_info, eb, 0); |
519 | return 0; | ||
520 | } | 519 | } |
521 | 520 | ||
522 | static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, | 521 | static int check_tree_block_fsid(struct btrfs_fs_info *fs_info, |
@@ -660,10 +659,8 @@ static int btree_readpage_end_io_hook(struct btrfs_io_bio *io_bio, | |||
660 | eb, found_level); | 659 | eb, found_level); |
661 | 660 | ||
662 | ret = csum_tree_block(fs_info, eb, 1); | 661 | ret = csum_tree_block(fs_info, eb, 1); |
663 | if (ret) { | 662 | if (ret) |
664 | ret = -EIO; | ||
665 | goto err; | 663 | goto err; |
666 | } | ||
667 | 664 | ||
668 | /* | 665 | /* |
669 | * If this is a leaf block and it is corrupt, set the corrupt bit so | 666 | * If this is a leaf block and it is corrupt, set the corrupt bit so |