diff options
author | Goldwyn Rodrigues <rgoldwyn@suse.de> | 2015-09-04 18:44:17 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-09-04 19:54:41 -0400 |
commit | 17a5b9ab32fe0464e7f556e28a2b49d2023fb533 (patch) | |
tree | cc05fa0cd282c144f3c1a30c8bf6b84a150db660 | |
parent | 7d0fb9148ab6f52006de7cce18860227594ba872 (diff) |
ocfs2: acknowledge return value of ocfs2_error()
Caveat: This may return -EROFS for a read case, which seems wrong. This
is happening even without this patch series though. Should we convert
EROFS to EIO?
Signed-off-by: Goldwyn Rodrigues <rgoldwyn@suse.com>
Cc: Mark Fasheh <mfasheh@suse.com>
Cc: Joel Becker <jlbec@evilplan.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | fs/ocfs2/alloc.c | 16 | ||||
-rw-r--r-- | fs/ocfs2/dir.c | 25 | ||||
-rw-r--r-- | fs/ocfs2/inode.c | 8 | ||||
-rw-r--r-- | fs/ocfs2/move_extents.c | 3 | ||||
-rw-r--r-- | fs/ocfs2/refcounttree.c | 42 | ||||
-rw-r--r-- | fs/ocfs2/suballoc.c | 25 | ||||
-rw-r--r-- | fs/ocfs2/xattr.c | 15 |
7 files changed, 51 insertions, 83 deletions
diff --git a/fs/ocfs2/alloc.c b/fs/ocfs2/alloc.c index 5997c00a1515..9a0fd494fe74 100644 --- a/fs/ocfs2/alloc.c +++ b/fs/ocfs2/alloc.c | |||
@@ -908,32 +908,32 @@ static int ocfs2_validate_extent_block(struct super_block *sb, | |||
908 | */ | 908 | */ |
909 | 909 | ||
910 | if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { | 910 | if (!OCFS2_IS_VALID_EXTENT_BLOCK(eb)) { |
911 | ocfs2_error(sb, | 911 | rc = ocfs2_error(sb, |
912 | "Extent block #%llu has bad signature %.*s", | 912 | "Extent block #%llu has bad signature %.*s", |
913 | (unsigned long long)bh->b_blocknr, 7, | 913 | (unsigned long long)bh->b_blocknr, 7, |
914 | eb->h_signature); | 914 | eb->h_signature); |
915 | return -EINVAL; | 915 | goto bail; |
916 | } | 916 | } |
917 | 917 | ||
918 | if (le64_to_cpu(eb->h_blkno) != bh->b_blocknr) { | 918 | if (le64_to_cpu(eb->h_blkno) != bh->b_blocknr) { |
919 | ocfs2_error(sb, | 919 | rc = ocfs2_error(sb, |
920 | "Extent block #%llu has an invalid h_blkno " | 920 | "Extent block #%llu has an invalid h_blkno " |
921 | "of %llu", | 921 | "of %llu", |
922 | (unsigned long long)bh->b_blocknr, | 922 | (unsigned long long)bh->b_blocknr, |
923 | (unsigned long long)le64_to_cpu(eb->h_blkno)); | 923 | (unsigned long long)le64_to_cpu(eb->h_blkno)); |
924 | return -EINVAL; | 924 | goto bail; |
925 | } | 925 | } |
926 | 926 | ||
927 | if (le32_to_cpu(eb->h_fs_generation) != OCFS2_SB(sb)->fs_generation) { | 927 | if (le32_to_cpu(eb->h_fs_generation) != OCFS2_SB(sb)->fs_generation) { |
928 | ocfs2_error(sb, | 928 | rc = ocfs2_error(sb, |
929 | "Extent block #%llu has an invalid " | 929 | "Extent block #%llu has an invalid " |
930 | "h_fs_generation of #%u", | 930 | "h_fs_generation of #%u", |
931 | (unsigned long long)bh->b_blocknr, | 931 | (unsigned long long)bh->b_blocknr, |
932 | le32_to_cpu(eb->h_fs_generation)); | 932 | le32_to_cpu(eb->h_fs_generation)); |
933 | return -EINVAL; | 933 | goto bail; |
934 | } | 934 | } |
935 | 935 | bail: | |
936 | return 0; | 936 | return rc; |
937 | } | 937 | } |
938 | 938 | ||
939 | int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno, | 939 | int ocfs2_read_extent_block(struct ocfs2_caching_info *ci, u64 eb_blkno, |
diff --git a/fs/ocfs2/dir.c b/fs/ocfs2/dir.c index 02878a83f0b4..25f03af09237 100644 --- a/fs/ocfs2/dir.c +++ b/fs/ocfs2/dir.c | |||
@@ -480,8 +480,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh) | |||
480 | 480 | ||
481 | trailer = ocfs2_trailer_from_bh(bh, dir->i_sb); | 481 | trailer = ocfs2_trailer_from_bh(bh, dir->i_sb); |
482 | if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) { | 482 | if (!OCFS2_IS_VALID_DIR_TRAILER(trailer)) { |
483 | rc = -EINVAL; | 483 | rc = ocfs2_error(dir->i_sb, |
484 | ocfs2_error(dir->i_sb, | ||
485 | "Invalid dirblock #%llu: " | 484 | "Invalid dirblock #%llu: " |
486 | "signature = %.*s\n", | 485 | "signature = %.*s\n", |
487 | (unsigned long long)bh->b_blocknr, 7, | 486 | (unsigned long long)bh->b_blocknr, 7, |
@@ -489,8 +488,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh) | |||
489 | goto out; | 488 | goto out; |
490 | } | 489 | } |
491 | if (le64_to_cpu(trailer->db_blkno) != bh->b_blocknr) { | 490 | if (le64_to_cpu(trailer->db_blkno) != bh->b_blocknr) { |
492 | rc = -EINVAL; | 491 | rc = ocfs2_error(dir->i_sb, |
493 | ocfs2_error(dir->i_sb, | ||
494 | "Directory block #%llu has an invalid " | 492 | "Directory block #%llu has an invalid " |
495 | "db_blkno of %llu", | 493 | "db_blkno of %llu", |
496 | (unsigned long long)bh->b_blocknr, | 494 | (unsigned long long)bh->b_blocknr, |
@@ -499,8 +497,7 @@ static int ocfs2_check_dir_trailer(struct inode *dir, struct buffer_head *bh) | |||
499 | } | 497 | } |
500 | if (le64_to_cpu(trailer->db_parent_dinode) != | 498 | if (le64_to_cpu(trailer->db_parent_dinode) != |
501 | OCFS2_I(dir)->ip_blkno) { | 499 | OCFS2_I(dir)->ip_blkno) { |
502 | rc = -EINVAL; | 500 | rc = ocfs2_error(dir->i_sb, |
503 | ocfs2_error(dir->i_sb, | ||
504 | "Directory block #%llu on dinode " | 501 | "Directory block #%llu on dinode " |
505 | "#%llu has an invalid parent_dinode " | 502 | "#%llu has an invalid parent_dinode " |
506 | "of %llu", | 503 | "of %llu", |
@@ -604,14 +601,13 @@ static int ocfs2_validate_dx_root(struct super_block *sb, | |||
604 | } | 601 | } |
605 | 602 | ||
606 | if (!OCFS2_IS_VALID_DX_ROOT(dx_root)) { | 603 | if (!OCFS2_IS_VALID_DX_ROOT(dx_root)) { |
607 | ocfs2_error(sb, | 604 | ret = ocfs2_error(sb, |
608 | "Dir Index Root # %llu has bad signature %.*s", | 605 | "Dir Index Root # %llu has bad signature %.*s", |
609 | (unsigned long long)le64_to_cpu(dx_root->dr_blkno), | 606 | (unsigned long long)le64_to_cpu(dx_root->dr_blkno), |
610 | 7, dx_root->dr_signature); | 607 | 7, dx_root->dr_signature); |
611 | return -EINVAL; | ||
612 | } | 608 | } |
613 | 609 | ||
614 | return 0; | 610 | return ret; |
615 | } | 611 | } |
616 | 612 | ||
617 | static int ocfs2_read_dx_root(struct inode *dir, struct ocfs2_dinode *di, | 613 | static int ocfs2_read_dx_root(struct inode *dir, struct ocfs2_dinode *di, |
@@ -648,12 +644,11 @@ static int ocfs2_validate_dx_leaf(struct super_block *sb, | |||
648 | } | 644 | } |
649 | 645 | ||
650 | if (!OCFS2_IS_VALID_DX_LEAF(dx_leaf)) { | 646 | if (!OCFS2_IS_VALID_DX_LEAF(dx_leaf)) { |
651 | ocfs2_error(sb, "Dir Index Leaf has bad signature %.*s", | 647 | ret = ocfs2_error(sb, "Dir Index Leaf has bad signature %.*s", |
652 | 7, dx_leaf->dl_signature); | 648 | 7, dx_leaf->dl_signature); |
653 | return -EROFS; | ||
654 | } | 649 | } |
655 | 650 | ||
656 | return 0; | 651 | return ret; |
657 | } | 652 | } |
658 | 653 | ||
659 | static int ocfs2_read_dx_leaf(struct inode *dir, u64 blkno, | 654 | static int ocfs2_read_dx_leaf(struct inode *dir, u64 blkno, |
@@ -812,11 +807,10 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, | |||
812 | el = &eb->h_list; | 807 | el = &eb->h_list; |
813 | 808 | ||
814 | if (el->l_tree_depth) { | 809 | if (el->l_tree_depth) { |
815 | ocfs2_error(inode->i_sb, | 810 | ret = ocfs2_error(inode->i_sb, |
816 | "Inode %lu has non zero tree depth in " | 811 | "Inode %lu has non zero tree depth in " |
817 | "btree tree block %llu\n", inode->i_ino, | 812 | "btree tree block %llu\n", inode->i_ino, |
818 | (unsigned long long)eb_bh->b_blocknr); | 813 | (unsigned long long)eb_bh->b_blocknr); |
819 | ret = -EROFS; | ||
820 | goto out; | 814 | goto out; |
821 | } | 815 | } |
822 | } | 816 | } |
@@ -832,11 +826,10 @@ static int ocfs2_dx_dir_lookup_rec(struct inode *inode, | |||
832 | } | 826 | } |
833 | 827 | ||
834 | if (!found) { | 828 | if (!found) { |
835 | ocfs2_error(inode->i_sb, "Inode %lu has bad extent " | 829 | ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent " |
836 | "record (%u, %u, 0) in btree", inode->i_ino, | 830 | "record (%u, %u, 0) in btree", inode->i_ino, |
837 | le32_to_cpu(rec->e_cpos), | 831 | le32_to_cpu(rec->e_cpos), |
838 | ocfs2_rec_clusters(el, rec)); | 832 | ocfs2_rec_clusters(el, rec)); |
839 | ret = -EROFS; | ||
840 | goto out; | 833 | goto out; |
841 | } | 834 | } |
842 | 835 | ||
diff --git a/fs/ocfs2/inode.c b/fs/ocfs2/inode.c index 4e69f3cbc5f1..7868f7e7c455 100644 --- a/fs/ocfs2/inode.c +++ b/fs/ocfs2/inode.c | |||
@@ -1352,21 +1352,21 @@ int ocfs2_validate_inode_block(struct super_block *sb, | |||
1352 | rc = -EINVAL; | 1352 | rc = -EINVAL; |
1353 | 1353 | ||
1354 | if (!OCFS2_IS_VALID_DINODE(di)) { | 1354 | if (!OCFS2_IS_VALID_DINODE(di)) { |
1355 | ocfs2_error(sb, "Invalid dinode #%llu: signature = %.*s\n", | 1355 | rc = ocfs2_error(sb, "Invalid dinode #%llu: signature = %.*s\n", |
1356 | (unsigned long long)bh->b_blocknr, 7, | 1356 | (unsigned long long)bh->b_blocknr, 7, |
1357 | di->i_signature); | 1357 | di->i_signature); |
1358 | goto bail; | 1358 | goto bail; |
1359 | } | 1359 | } |
1360 | 1360 | ||
1361 | if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) { | 1361 | if (le64_to_cpu(di->i_blkno) != bh->b_blocknr) { |
1362 | ocfs2_error(sb, "Invalid dinode #%llu: i_blkno is %llu\n", | 1362 | rc = ocfs2_error(sb, "Invalid dinode #%llu: i_blkno is %llu\n", |
1363 | (unsigned long long)bh->b_blocknr, | 1363 | (unsigned long long)bh->b_blocknr, |
1364 | (unsigned long long)le64_to_cpu(di->i_blkno)); | 1364 | (unsigned long long)le64_to_cpu(di->i_blkno)); |
1365 | goto bail; | 1365 | goto bail; |
1366 | } | 1366 | } |
1367 | 1367 | ||
1368 | if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { | 1368 | if (!(di->i_flags & cpu_to_le32(OCFS2_VALID_FL))) { |
1369 | ocfs2_error(sb, | 1369 | rc = ocfs2_error(sb, |
1370 | "Invalid dinode #%llu: OCFS2_VALID_FL not set\n", | 1370 | "Invalid dinode #%llu: OCFS2_VALID_FL not set\n", |
1371 | (unsigned long long)bh->b_blocknr); | 1371 | (unsigned long long)bh->b_blocknr); |
1372 | goto bail; | 1372 | goto bail; |
@@ -1374,7 +1374,7 @@ int ocfs2_validate_inode_block(struct super_block *sb, | |||
1374 | 1374 | ||
1375 | if (le32_to_cpu(di->i_fs_generation) != | 1375 | if (le32_to_cpu(di->i_fs_generation) != |
1376 | OCFS2_SB(sb)->fs_generation) { | 1376 | OCFS2_SB(sb)->fs_generation) { |
1377 | ocfs2_error(sb, | 1377 | rc = ocfs2_error(sb, |
1378 | "Invalid dinode #%llu: fs_generation is %u\n", | 1378 | "Invalid dinode #%llu: fs_generation is %u\n", |
1379 | (unsigned long long)bh->b_blocknr, | 1379 | (unsigned long long)bh->b_blocknr, |
1380 | le32_to_cpu(di->i_fs_generation)); | 1380 | le32_to_cpu(di->i_fs_generation)); |
diff --git a/fs/ocfs2/move_extents.c b/fs/ocfs2/move_extents.c index 56a768d06aa6..70dd0ec7b7e9 100644 --- a/fs/ocfs2/move_extents.c +++ b/fs/ocfs2/move_extents.c | |||
@@ -99,11 +99,10 @@ static int __ocfs2_move_extent(handle_t *handle, | |||
99 | 99 | ||
100 | index = ocfs2_search_extent_list(el, cpos); | 100 | index = ocfs2_search_extent_list(el, cpos); |
101 | if (index == -1) { | 101 | if (index == -1) { |
102 | ocfs2_error(inode->i_sb, | 102 | ret = ocfs2_error(inode->i_sb, |
103 | "Inode %llu has an extent at cpos %u which can no " | 103 | "Inode %llu has an extent at cpos %u which can no " |
104 | "longer be found.\n", | 104 | "longer be found.\n", |
105 | (unsigned long long)ino, cpos); | 105 | (unsigned long long)ino, cpos); |
106 | ret = -EROFS; | ||
107 | goto out; | 106 | goto out; |
108 | } | 107 | } |
109 | 108 | ||
diff --git a/fs/ocfs2/refcounttree.c b/fs/ocfs2/refcounttree.c index 7dc818b87cd8..b404dbde3fe4 100644 --- a/fs/ocfs2/refcounttree.c +++ b/fs/ocfs2/refcounttree.c | |||
@@ -102,32 +102,32 @@ static int ocfs2_validate_refcount_block(struct super_block *sb, | |||
102 | 102 | ||
103 | 103 | ||
104 | if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { | 104 | if (!OCFS2_IS_VALID_REFCOUNT_BLOCK(rb)) { |
105 | ocfs2_error(sb, | 105 | rc = ocfs2_error(sb, |
106 | "Refcount block #%llu has bad signature %.*s", | 106 | "Refcount block #%llu has bad signature %.*s", |
107 | (unsigned long long)bh->b_blocknr, 7, | 107 | (unsigned long long)bh->b_blocknr, 7, |
108 | rb->rf_signature); | 108 | rb->rf_signature); |
109 | return -EINVAL; | 109 | goto out; |
110 | } | 110 | } |
111 | 111 | ||
112 | if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { | 112 | if (le64_to_cpu(rb->rf_blkno) != bh->b_blocknr) { |
113 | ocfs2_error(sb, | 113 | rc = ocfs2_error(sb, |
114 | "Refcount block #%llu has an invalid rf_blkno " | 114 | "Refcount block #%llu has an invalid rf_blkno " |
115 | "of %llu", | 115 | "of %llu", |
116 | (unsigned long long)bh->b_blocknr, | 116 | (unsigned long long)bh->b_blocknr, |
117 | (unsigned long long)le64_to_cpu(rb->rf_blkno)); | 117 | (unsigned long long)le64_to_cpu(rb->rf_blkno)); |
118 | return -EINVAL; | 118 | goto out; |
119 | } | 119 | } |
120 | 120 | ||
121 | if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { | 121 | if (le32_to_cpu(rb->rf_fs_generation) != OCFS2_SB(sb)->fs_generation) { |
122 | ocfs2_error(sb, | 122 | rc = ocfs2_error(sb, |
123 | "Refcount block #%llu has an invalid " | 123 | "Refcount block #%llu has an invalid " |
124 | "rf_fs_generation of #%u", | 124 | "rf_fs_generation of #%u", |
125 | (unsigned long long)bh->b_blocknr, | 125 | (unsigned long long)bh->b_blocknr, |
126 | le32_to_cpu(rb->rf_fs_generation)); | 126 | le32_to_cpu(rb->rf_fs_generation)); |
127 | return -EINVAL; | 127 | goto out; |
128 | } | 128 | } |
129 | 129 | out: | |
130 | return 0; | 130 | return rc; |
131 | } | 131 | } |
132 | 132 | ||
133 | static int ocfs2_read_refcount_block(struct ocfs2_caching_info *ci, | 133 | static int ocfs2_read_refcount_block(struct ocfs2_caching_info *ci, |
@@ -1102,12 +1102,11 @@ static int ocfs2_get_refcount_rec(struct ocfs2_caching_info *ci, | |||
1102 | el = &eb->h_list; | 1102 | el = &eb->h_list; |
1103 | 1103 | ||
1104 | if (el->l_tree_depth) { | 1104 | if (el->l_tree_depth) { |
1105 | ocfs2_error(sb, | 1105 | ret = ocfs2_error(sb, |
1106 | "refcount tree %llu has non zero tree " | 1106 | "refcount tree %llu has non zero tree " |
1107 | "depth in leaf btree tree block %llu\n", | 1107 | "depth in leaf btree tree block %llu\n", |
1108 | (unsigned long long)ocfs2_metadata_cache_owner(ci), | 1108 | (unsigned long long)ocfs2_metadata_cache_owner(ci), |
1109 | (unsigned long long)eb_bh->b_blocknr); | 1109 | (unsigned long long)eb_bh->b_blocknr); |
1110 | ret = -EROFS; | ||
1111 | goto out; | 1110 | goto out; |
1112 | } | 1111 | } |
1113 | } | 1112 | } |
@@ -2359,10 +2358,9 @@ static int ocfs2_mark_extent_refcounted(struct inode *inode, | |||
2359 | cpos, len, phys); | 2358 | cpos, len, phys); |
2360 | 2359 | ||
2361 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { | 2360 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { |
2362 | ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " | 2361 | ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " |
2363 | "tree, but the feature bit is not set in the " | 2362 | "tree, but the feature bit is not set in the " |
2364 | "super block.", inode->i_ino); | 2363 | "super block.", inode->i_ino); |
2365 | ret = -EROFS; | ||
2366 | goto out; | 2364 | goto out; |
2367 | } | 2365 | } |
2368 | 2366 | ||
@@ -2545,10 +2543,9 @@ int ocfs2_prepare_refcount_change_for_del(struct inode *inode, | |||
2545 | u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno); | 2543 | u64 start_cpos = ocfs2_blocks_to_clusters(inode->i_sb, phys_blkno); |
2546 | 2544 | ||
2547 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { | 2545 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { |
2548 | ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " | 2546 | ret = ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " |
2549 | "tree, but the feature bit is not set in the " | 2547 | "tree, but the feature bit is not set in the " |
2550 | "super block.", inode->i_ino); | 2548 | "super block.", inode->i_ino); |
2551 | ret = -EROFS; | ||
2552 | goto out; | 2549 | goto out; |
2553 | } | 2550 | } |
2554 | 2551 | ||
@@ -2672,11 +2669,10 @@ static int ocfs2_refcount_cal_cow_clusters(struct inode *inode, | |||
2672 | el = &eb->h_list; | 2669 | el = &eb->h_list; |
2673 | 2670 | ||
2674 | if (el->l_tree_depth) { | 2671 | if (el->l_tree_depth) { |
2675 | ocfs2_error(inode->i_sb, | 2672 | ret = ocfs2_error(inode->i_sb, |
2676 | "Inode %lu has non zero tree depth in " | 2673 | "Inode %lu has non zero tree depth in " |
2677 | "leaf block %llu\n", inode->i_ino, | 2674 | "leaf block %llu\n", inode->i_ino, |
2678 | (unsigned long long)eb_bh->b_blocknr); | 2675 | (unsigned long long)eb_bh->b_blocknr); |
2679 | ret = -EROFS; | ||
2680 | goto out; | 2676 | goto out; |
2681 | } | 2677 | } |
2682 | } | 2678 | } |
@@ -3106,11 +3102,10 @@ static int ocfs2_clear_ext_refcount(handle_t *handle, | |||
3106 | 3102 | ||
3107 | index = ocfs2_search_extent_list(el, cpos); | 3103 | index = ocfs2_search_extent_list(el, cpos); |
3108 | if (index == -1) { | 3104 | if (index == -1) { |
3109 | ocfs2_error(sb, | 3105 | ret = ocfs2_error(sb, |
3110 | "Inode %llu has an extent at cpos %u which can no " | 3106 | "Inode %llu has an extent at cpos %u which can no " |
3111 | "longer be found.\n", | 3107 | "longer be found.\n", |
3112 | (unsigned long long)ino, cpos); | 3108 | (unsigned long long)ino, cpos); |
3113 | ret = -EROFS; | ||
3114 | goto out; | 3109 | goto out; |
3115 | } | 3110 | } |
3116 | 3111 | ||
@@ -3376,10 +3371,9 @@ static int ocfs2_replace_cow(struct ocfs2_cow_context *context) | |||
3376 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); | 3371 | struct ocfs2_super *osb = OCFS2_SB(inode->i_sb); |
3377 | 3372 | ||
3378 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { | 3373 | if (!ocfs2_refcount_tree(OCFS2_SB(inode->i_sb))) { |
3379 | ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " | 3374 | return ocfs2_error(inode->i_sb, "Inode %lu want to use refcount " |
3380 | "tree, but the feature bit is not set in the " | 3375 | "tree, but the feature bit is not set in the " |
3381 | "super block.", inode->i_ino); | 3376 | "super block.", inode->i_ino); |
3382 | return -EROFS; | ||
3383 | } | 3377 | } |
3384 | 3378 | ||
3385 | ocfs2_init_dealloc_ctxt(&context->dealloc); | 3379 | ocfs2_init_dealloc_ctxt(&context->dealloc); |
diff --git a/fs/ocfs2/suballoc.c b/fs/ocfs2/suballoc.c index 4479029630bb..e4bb00110e91 100644 --- a/fs/ocfs2/suballoc.c +++ b/fs/ocfs2/suballoc.c | |||
@@ -171,7 +171,7 @@ static u32 ocfs2_bits_per_group(struct ocfs2_chain_list *cl) | |||
171 | if (resize) \ | 171 | if (resize) \ |
172 | mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \ | 172 | mlog(ML_ERROR, fmt "\n", ##__VA_ARGS__); \ |
173 | else \ | 173 | else \ |
174 | ocfs2_error(sb, fmt, ##__VA_ARGS__); \ | 174 | return ocfs2_error(sb, fmt, ##__VA_ARGS__); \ |
175 | } while (0) | 175 | } while (0) |
176 | 176 | ||
177 | static int ocfs2_validate_gd_self(struct super_block *sb, | 177 | static int ocfs2_validate_gd_self(struct super_block *sb, |
@@ -184,7 +184,6 @@ static int ocfs2_validate_gd_self(struct super_block *sb, | |||
184 | do_error("Group descriptor #%llu has bad signature %.*s", | 184 | do_error("Group descriptor #%llu has bad signature %.*s", |
185 | (unsigned long long)bh->b_blocknr, 7, | 185 | (unsigned long long)bh->b_blocknr, 7, |
186 | gd->bg_signature); | 186 | gd->bg_signature); |
187 | return -EINVAL; | ||
188 | } | 187 | } |
189 | 188 | ||
190 | if (le64_to_cpu(gd->bg_blkno) != bh->b_blocknr) { | 189 | if (le64_to_cpu(gd->bg_blkno) != bh->b_blocknr) { |
@@ -192,7 +191,6 @@ static int ocfs2_validate_gd_self(struct super_block *sb, | |||
192 | "of %llu", | 191 | "of %llu", |
193 | (unsigned long long)bh->b_blocknr, | 192 | (unsigned long long)bh->b_blocknr, |
194 | (unsigned long long)le64_to_cpu(gd->bg_blkno)); | 193 | (unsigned long long)le64_to_cpu(gd->bg_blkno)); |
195 | return -EINVAL; | ||
196 | } | 194 | } |
197 | 195 | ||
198 | if (le32_to_cpu(gd->bg_generation) != OCFS2_SB(sb)->fs_generation) { | 196 | if (le32_to_cpu(gd->bg_generation) != OCFS2_SB(sb)->fs_generation) { |
@@ -200,7 +198,6 @@ static int ocfs2_validate_gd_self(struct super_block *sb, | |||
200 | "fs_generation of #%u", | 198 | "fs_generation of #%u", |
201 | (unsigned long long)bh->b_blocknr, | 199 | (unsigned long long)bh->b_blocknr, |
202 | le32_to_cpu(gd->bg_generation)); | 200 | le32_to_cpu(gd->bg_generation)); |
203 | return -EINVAL; | ||
204 | } | 201 | } |
205 | 202 | ||
206 | if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) { | 203 | if (le16_to_cpu(gd->bg_free_bits_count) > le16_to_cpu(gd->bg_bits)) { |
@@ -209,7 +206,6 @@ static int ocfs2_validate_gd_self(struct super_block *sb, | |||
209 | (unsigned long long)bh->b_blocknr, | 206 | (unsigned long long)bh->b_blocknr, |
210 | le16_to_cpu(gd->bg_bits), | 207 | le16_to_cpu(gd->bg_bits), |
211 | le16_to_cpu(gd->bg_free_bits_count)); | 208 | le16_to_cpu(gd->bg_free_bits_count)); |
212 | return -EINVAL; | ||
213 | } | 209 | } |
214 | 210 | ||
215 | if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) { | 211 | if (le16_to_cpu(gd->bg_bits) > (8 * le16_to_cpu(gd->bg_size))) { |
@@ -218,7 +214,6 @@ static int ocfs2_validate_gd_self(struct super_block *sb, | |||
218 | (unsigned long long)bh->b_blocknr, | 214 | (unsigned long long)bh->b_blocknr, |
219 | le16_to_cpu(gd->bg_bits), | 215 | le16_to_cpu(gd->bg_bits), |
220 | 8 * le16_to_cpu(gd->bg_size)); | 216 | 8 * le16_to_cpu(gd->bg_size)); |
221 | return -EINVAL; | ||
222 | } | 217 | } |
223 | 218 | ||
224 | return 0; | 219 | return 0; |
@@ -238,7 +233,6 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, | |||
238 | (unsigned long long)bh->b_blocknr, | 233 | (unsigned long long)bh->b_blocknr, |
239 | (unsigned long long)le64_to_cpu(gd->bg_parent_dinode), | 234 | (unsigned long long)le64_to_cpu(gd->bg_parent_dinode), |
240 | (unsigned long long)le64_to_cpu(di->i_blkno)); | 235 | (unsigned long long)le64_to_cpu(di->i_blkno)); |
241 | return -EINVAL; | ||
242 | } | 236 | } |
243 | 237 | ||
244 | max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); | 238 | max_bits = le16_to_cpu(di->id2.i_chain.cl_cpg) * le16_to_cpu(di->id2.i_chain.cl_bpc); |
@@ -246,7 +240,6 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, | |||
246 | do_error("Group descriptor #%llu has bit count of %u", | 240 | do_error("Group descriptor #%llu has bit count of %u", |
247 | (unsigned long long)bh->b_blocknr, | 241 | (unsigned long long)bh->b_blocknr, |
248 | le16_to_cpu(gd->bg_bits)); | 242 | le16_to_cpu(gd->bg_bits)); |
249 | return -EINVAL; | ||
250 | } | 243 | } |
251 | 244 | ||
252 | /* In resize, we may meet the case bg_chain == cl_next_free_rec. */ | 245 | /* In resize, we may meet the case bg_chain == cl_next_free_rec. */ |
@@ -257,7 +250,6 @@ static int ocfs2_validate_gd_parent(struct super_block *sb, | |||
257 | do_error("Group descriptor #%llu has bad chain %u", | 250 | do_error("Group descriptor #%llu has bad chain %u", |
258 | (unsigned long long)bh->b_blocknr, | 251 | (unsigned long long)bh->b_blocknr, |
259 | le16_to_cpu(gd->bg_chain)); | 252 | le16_to_cpu(gd->bg_chain)); |
260 | return -EINVAL; | ||
261 | } | 253 | } |
262 | 254 | ||
263 | return 0; | 255 | return 0; |
@@ -384,11 +376,10 @@ static int ocfs2_block_group_fill(handle_t *handle, | |||
384 | struct super_block * sb = alloc_inode->i_sb; | 376 | struct super_block * sb = alloc_inode->i_sb; |
385 | 377 | ||
386 | if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) { | 378 | if (((unsigned long long) bg_bh->b_blocknr) != group_blkno) { |
387 | ocfs2_error(alloc_inode->i_sb, "group block (%llu) != " | 379 | status = ocfs2_error(alloc_inode->i_sb, "group block (%llu) != " |
388 | "b_blocknr (%llu)", | 380 | "b_blocknr (%llu)", |
389 | (unsigned long long)group_blkno, | 381 | (unsigned long long)group_blkno, |
390 | (unsigned long long) bg_bh->b_blocknr); | 382 | (unsigned long long) bg_bh->b_blocknr); |
391 | status = -EIO; | ||
392 | goto bail; | 383 | goto bail; |
393 | } | 384 | } |
394 | 385 | ||
@@ -834,9 +825,8 @@ static int ocfs2_reserve_suballoc_bits(struct ocfs2_super *osb, | |||
834 | BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); | 825 | BUG_ON(!OCFS2_IS_VALID_DINODE(fe)); |
835 | 826 | ||
836 | if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) { | 827 | if (!(fe->i_flags & cpu_to_le32(OCFS2_CHAIN_FL))) { |
837 | ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator %llu", | 828 | status = ocfs2_error(alloc_inode->i_sb, "Invalid chain allocator %llu", |
838 | (unsigned long long)le64_to_cpu(fe->i_blkno)); | 829 | (unsigned long long)le64_to_cpu(fe->i_blkno)); |
839 | status = -EIO; | ||
840 | goto bail; | 830 | goto bail; |
841 | } | 831 | } |
842 | 832 | ||
@@ -1370,12 +1360,11 @@ int ocfs2_block_group_set_bits(handle_t *handle, | |||
1370 | 1360 | ||
1371 | le16_add_cpu(&bg->bg_free_bits_count, -num_bits); | 1361 | le16_add_cpu(&bg->bg_free_bits_count, -num_bits); |
1372 | if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { | 1362 | if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { |
1373 | ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" | 1363 | return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" |
1374 | " count %u but claims %u are freed. num_bits %d", | 1364 | " count %u but claims %u are freed. num_bits %d", |
1375 | (unsigned long long)le64_to_cpu(bg->bg_blkno), | 1365 | (unsigned long long)le64_to_cpu(bg->bg_blkno), |
1376 | le16_to_cpu(bg->bg_bits), | 1366 | le16_to_cpu(bg->bg_bits), |
1377 | le16_to_cpu(bg->bg_free_bits_count), num_bits); | 1367 | le16_to_cpu(bg->bg_free_bits_count), num_bits); |
1378 | return -EROFS; | ||
1379 | } | 1368 | } |
1380 | while(num_bits--) | 1369 | while(num_bits--) |
1381 | ocfs2_set_bit(bit_off++, bitmap); | 1370 | ocfs2_set_bit(bit_off++, bitmap); |
@@ -1905,13 +1894,12 @@ static int ocfs2_claim_suballoc_bits(struct ocfs2_alloc_context *ac, | |||
1905 | 1894 | ||
1906 | if (le32_to_cpu(fe->id1.bitmap1.i_used) >= | 1895 | if (le32_to_cpu(fe->id1.bitmap1.i_used) >= |
1907 | le32_to_cpu(fe->id1.bitmap1.i_total)) { | 1896 | le32_to_cpu(fe->id1.bitmap1.i_total)) { |
1908 | ocfs2_error(ac->ac_inode->i_sb, | 1897 | status = ocfs2_error(ac->ac_inode->i_sb, |
1909 | "Chain allocator dinode %llu has %u used " | 1898 | "Chain allocator dinode %llu has %u used " |
1910 | "bits but only %u total.", | 1899 | "bits but only %u total.", |
1911 | (unsigned long long)le64_to_cpu(fe->i_blkno), | 1900 | (unsigned long long)le64_to_cpu(fe->i_blkno), |
1912 | le32_to_cpu(fe->id1.bitmap1.i_used), | 1901 | le32_to_cpu(fe->id1.bitmap1.i_used), |
1913 | le32_to_cpu(fe->id1.bitmap1.i_total)); | 1902 | le32_to_cpu(fe->id1.bitmap1.i_total)); |
1914 | status = -EIO; | ||
1915 | goto bail; | 1903 | goto bail; |
1916 | } | 1904 | } |
1917 | 1905 | ||
@@ -2429,12 +2417,11 @@ static int ocfs2_block_group_clear_bits(handle_t *handle, | |||
2429 | } | 2417 | } |
2430 | le16_add_cpu(&bg->bg_free_bits_count, num_bits); | 2418 | le16_add_cpu(&bg->bg_free_bits_count, num_bits); |
2431 | if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { | 2419 | if (le16_to_cpu(bg->bg_free_bits_count) > le16_to_cpu(bg->bg_bits)) { |
2432 | ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" | 2420 | return ocfs2_error(alloc_inode->i_sb, "Group descriptor # %llu has bit" |
2433 | " count %u but claims %u are freed. num_bits %d", | 2421 | " count %u but claims %u are freed. num_bits %d", |
2434 | (unsigned long long)le64_to_cpu(bg->bg_blkno), | 2422 | (unsigned long long)le64_to_cpu(bg->bg_blkno), |
2435 | le16_to_cpu(bg->bg_bits), | 2423 | le16_to_cpu(bg->bg_bits), |
2436 | le16_to_cpu(bg->bg_free_bits_count), num_bits); | 2424 | le16_to_cpu(bg->bg_free_bits_count), num_bits); |
2437 | return -EROFS; | ||
2438 | } | 2425 | } |
2439 | 2426 | ||
2440 | if (undo_fn) | 2427 | if (undo_fn) |
diff --git a/fs/ocfs2/xattr.c b/fs/ocfs2/xattr.c index a24f264b2fc4..5944a311bb94 100644 --- a/fs/ocfs2/xattr.c +++ b/fs/ocfs2/xattr.c | |||
@@ -499,30 +499,27 @@ static int ocfs2_validate_xattr_block(struct super_block *sb, | |||
499 | */ | 499 | */ |
500 | 500 | ||
501 | if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) { | 501 | if (!OCFS2_IS_VALID_XATTR_BLOCK(xb)) { |
502 | ocfs2_error(sb, | 502 | return ocfs2_error(sb, |
503 | "Extended attribute block #%llu has bad " | 503 | "Extended attribute block #%llu has bad " |
504 | "signature %.*s", | 504 | "signature %.*s", |
505 | (unsigned long long)bh->b_blocknr, 7, | 505 | (unsigned long long)bh->b_blocknr, 7, |
506 | xb->xb_signature); | 506 | xb->xb_signature); |
507 | return -EINVAL; | ||
508 | } | 507 | } |
509 | 508 | ||
510 | if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) { | 509 | if (le64_to_cpu(xb->xb_blkno) != bh->b_blocknr) { |
511 | ocfs2_error(sb, | 510 | return ocfs2_error(sb, |
512 | "Extended attribute block #%llu has an " | 511 | "Extended attribute block #%llu has an " |
513 | "invalid xb_blkno of %llu", | 512 | "invalid xb_blkno of %llu", |
514 | (unsigned long long)bh->b_blocknr, | 513 | (unsigned long long)bh->b_blocknr, |
515 | (unsigned long long)le64_to_cpu(xb->xb_blkno)); | 514 | (unsigned long long)le64_to_cpu(xb->xb_blkno)); |
516 | return -EINVAL; | ||
517 | } | 515 | } |
518 | 516 | ||
519 | if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) { | 517 | if (le32_to_cpu(xb->xb_fs_generation) != OCFS2_SB(sb)->fs_generation) { |
520 | ocfs2_error(sb, | 518 | return ocfs2_error(sb, |
521 | "Extended attribute block #%llu has an invalid " | 519 | "Extended attribute block #%llu has an invalid " |
522 | "xb_fs_generation of #%u", | 520 | "xb_fs_generation of #%u", |
523 | (unsigned long long)bh->b_blocknr, | 521 | (unsigned long long)bh->b_blocknr, |
524 | le32_to_cpu(xb->xb_fs_generation)); | 522 | le32_to_cpu(xb->xb_fs_generation)); |
525 | return -EINVAL; | ||
526 | } | 523 | } |
527 | 524 | ||
528 | return 0; | 525 | return 0; |
@@ -3694,11 +3691,10 @@ static int ocfs2_xattr_get_rec(struct inode *inode, | |||
3694 | el = &eb->h_list; | 3691 | el = &eb->h_list; |
3695 | 3692 | ||
3696 | if (el->l_tree_depth) { | 3693 | if (el->l_tree_depth) { |
3697 | ocfs2_error(inode->i_sb, | 3694 | ret = ocfs2_error(inode->i_sb, |
3698 | "Inode %lu has non zero tree depth in " | 3695 | "Inode %lu has non zero tree depth in " |
3699 | "xattr tree block %llu\n", inode->i_ino, | 3696 | "xattr tree block %llu\n", inode->i_ino, |
3700 | (unsigned long long)eb_bh->b_blocknr); | 3697 | (unsigned long long)eb_bh->b_blocknr); |
3701 | ret = -EROFS; | ||
3702 | goto out; | 3698 | goto out; |
3703 | } | 3699 | } |
3704 | } | 3700 | } |
@@ -3713,11 +3709,10 @@ static int ocfs2_xattr_get_rec(struct inode *inode, | |||
3713 | } | 3709 | } |
3714 | 3710 | ||
3715 | if (!e_blkno) { | 3711 | if (!e_blkno) { |
3716 | ocfs2_error(inode->i_sb, "Inode %lu has bad extent " | 3712 | ret = ocfs2_error(inode->i_sb, "Inode %lu has bad extent " |
3717 | "record (%u, %u, 0) in xattr", inode->i_ino, | 3713 | "record (%u, %u, 0) in xattr", inode->i_ino, |
3718 | le32_to_cpu(rec->e_cpos), | 3714 | le32_to_cpu(rec->e_cpos), |
3719 | ocfs2_rec_clusters(el, rec)); | 3715 | ocfs2_rec_clusters(el, rec)); |
3720 | ret = -EROFS; | ||
3721 | goto out; | 3716 | goto out; |
3722 | } | 3717 | } |
3723 | 3718 | ||