diff options
Diffstat (limited to 'fs/ext4')
-rw-r--r-- | fs/ext4/dir.c | 10 | ||||
-rw-r--r-- | fs/ext4/ext4.h | 4 | ||||
-rw-r--r-- | fs/ext4/extents.c | 10 | ||||
-rw-r--r-- | fs/ext4/inode.c | 83 | ||||
-rw-r--r-- | fs/ext4/move_extent.c | 8 | ||||
-rw-r--r-- | fs/ext4/namei.c | 39 | ||||
-rw-r--r-- | fs/ext4/xattr.c | 35 |
7 files changed, 86 insertions, 103 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index e3f2700b8be7..6a2b8bcff641 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -83,11 +83,10 @@ int ext4_check_dir_entry(const char *function, struct inode *dir, | |||
83 | error_msg = "inode out of bounds"; | 83 | error_msg = "inode out of bounds"; |
84 | 84 | ||
85 | if (error_msg != NULL) | 85 | if (error_msg != NULL) |
86 | __ext4_error(dir->i_sb, function, | 86 | ext4_error_inode(function, dir, |
87 | "bad entry in directory #%lu: %s - block=%llu" | 87 | "bad entry in directory: %s - block=%llu" |
88 | "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d", | 88 | "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d", |
89 | dir->i_ino, error_msg, | 89 | error_msg, (unsigned long long) bh->b_blocknr, |
90 | (unsigned long long) bh->b_blocknr, | ||
91 | (unsigned) (offset%bh->b_size), offset, | 90 | (unsigned) (offset%bh->b_size), offset, |
92 | le32_to_cpu(de->inode), | 91 | le32_to_cpu(de->inode), |
93 | rlen, de->name_len); | 92 | rlen, de->name_len); |
@@ -152,9 +151,8 @@ static int ext4_readdir(struct file *filp, | |||
152 | */ | 151 | */ |
153 | if (!bh) { | 152 | if (!bh) { |
154 | if (!dir_has_error) { | 153 | if (!dir_has_error) { |
155 | ext4_error(sb, "directory #%lu " | 154 | EXT4_ERROR_INODE(inode, "directory " |
156 | "contains a hole at offset %Lu", | 155 | "contains a hole at offset %Lu", |
157 | inode->i_ino, | ||
158 | (unsigned long long) filp->f_pos); | 156 | (unsigned long long) filp->f_pos); |
159 | dir_has_error = 1; | 157 | dir_has_error = 1; |
160 | } | 158 | } |
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h index 57fc0e5c0918..413321ff1e20 100644 --- a/fs/ext4/ext4.h +++ b/fs/ext4/ext4.h | |||
@@ -54,10 +54,10 @@ | |||
54 | #endif | 54 | #endif |
55 | 55 | ||
56 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ | 56 | #define EXT4_ERROR_INODE(inode, fmt, a...) \ |
57 | ext4_error_inode(__func__, (inode), (fmt), ## a); | 57 | ext4_error_inode(__func__, (inode), (fmt), ## a) |
58 | 58 | ||
59 | #define EXT4_ERROR_FILE(file, fmt, a...) \ | 59 | #define EXT4_ERROR_FILE(file, fmt, a...) \ |
60 | ext4_error_file(__func__, (file), (fmt), ## a); | 60 | ext4_error_file(__func__, (file), (fmt), ## a) |
61 | 61 | ||
62 | /* data type for block offset of block group */ | 62 | /* data type for block offset of block group */ |
63 | typedef int ext4_grpblk_t; | 63 | typedef int ext4_grpblk_t; |
diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c index d6801eb7232b..91c3873970e4 100644 --- a/fs/ext4/extents.c +++ b/fs/ext4/extents.c | |||
@@ -439,10 +439,10 @@ static int __ext4_ext_check(const char *function, struct inode *inode, | |||
439 | return 0; | 439 | return 0; |
440 | 440 | ||
441 | corrupted: | 441 | corrupted: |
442 | __ext4_error(inode->i_sb, function, | 442 | ext4_error_inode(function, inode, |
443 | "bad header/extent in inode #%lu: %s - magic %x, " | 443 | "bad header/extent: %s - magic %x, " |
444 | "entries %u, max %u(%u), depth %u(%u)", | 444 | "entries %u, max %u(%u), depth %u(%u)", |
445 | inode->i_ino, error_msg, le16_to_cpu(eh->eh_magic), | 445 | error_msg, le16_to_cpu(eh->eh_magic), |
446 | le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max), | 446 | le16_to_cpu(eh->eh_entries), le16_to_cpu(eh->eh_max), |
447 | max, le16_to_cpu(eh->eh_depth), depth); | 447 | max, le16_to_cpu(eh->eh_depth), depth); |
448 | 448 | ||
@@ -1622,9 +1622,7 @@ int ext4_ext_try_to_merge(struct inode *inode, | |||
1622 | merge_done = 1; | 1622 | merge_done = 1; |
1623 | WARN_ON(eh->eh_entries == 0); | 1623 | WARN_ON(eh->eh_entries == 0); |
1624 | if (!eh->eh_entries) | 1624 | if (!eh->eh_entries) |
1625 | ext4_error(inode->i_sb, | 1625 | EXT4_ERROR_INODE(inode, "eh->eh_entries = 0!"); |
1626 | "inode#%lu, eh->eh_entries = 0!", | ||
1627 | inode->i_ino); | ||
1628 | } | 1626 | } |
1629 | 1627 | ||
1630 | return merge_done; | 1628 | return merge_done; |
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index 0b1d7c89f93f..3b6877257580 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
@@ -348,9 +348,8 @@ static int __ext4_check_blockref(const char *function, struct inode *inode, | |||
348 | if (blk && | 348 | if (blk && |
349 | unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), | 349 | unlikely(!ext4_data_block_valid(EXT4_SB(inode->i_sb), |
350 | blk, 1))) { | 350 | blk, 1))) { |
351 | __ext4_error(inode->i_sb, function, | 351 | ext4_error_inode(function, inode, |
352 | "invalid block reference %u " | 352 | "invalid block reference %u", blk); |
353 | "in inode #%lu", blk, inode->i_ino); | ||
354 | return -EIO; | 353 | return -EIO; |
355 | } | 354 | } |
356 | } | 355 | } |
@@ -1129,15 +1128,15 @@ void ext4_da_update_reserve_space(struct inode *inode, | |||
1129 | ext4_discard_preallocations(inode); | 1128 | ext4_discard_preallocations(inode); |
1130 | } | 1129 | } |
1131 | 1130 | ||
1132 | static int check_block_validity(struct inode *inode, const char *msg, | 1131 | static int check_block_validity(struct inode *inode, const char *func, |
1133 | sector_t logical, sector_t phys, int len) | 1132 | struct ext4_map_blocks *map) |
1134 | { | 1133 | { |
1135 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) { | 1134 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), map->m_pblk, |
1136 | __ext4_error(inode->i_sb, msg, | 1135 | map->m_len)) { |
1137 | "inode #%lu logical block %llu mapped to %llu " | 1136 | ext4_error_inode(func, inode, |
1138 | "(size %d)", inode->i_ino, | 1137 | "lblock %lu mapped to illegal pblock %llu " |
1139 | (unsigned long long) logical, | 1138 | "(length %d)", (unsigned long) map->m_lblk, |
1140 | (unsigned long long) phys, len); | 1139 | map->m_pblk, map->m_len); |
1141 | return -EIO; | 1140 | return -EIO; |
1142 | } | 1141 | } |
1143 | return 0; | 1142 | return 0; |
@@ -1245,8 +1244,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
1245 | up_read((&EXT4_I(inode)->i_data_sem)); | 1244 | up_read((&EXT4_I(inode)->i_data_sem)); |
1246 | 1245 | ||
1247 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { | 1246 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { |
1248 | int ret = check_block_validity(inode, "file system corruption", | 1247 | int ret = check_block_validity(inode, __func__, map); |
1249 | map->m_lblk, map->m_pblk, retval); | ||
1250 | if (ret != 0) | 1248 | if (ret != 0) |
1251 | return ret; | 1249 | return ret; |
1252 | } | 1250 | } |
@@ -1326,10 +1324,9 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode, | |||
1326 | 1324 | ||
1327 | up_write((&EXT4_I(inode)->i_data_sem)); | 1325 | up_write((&EXT4_I(inode)->i_data_sem)); |
1328 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { | 1326 | if (retval > 0 && map->m_flags & EXT4_MAP_MAPPED) { |
1329 | int ret = check_block_validity(inode, "file system " | 1327 | int ret = check_block_validity(inode, |
1330 | "corruption after allocation", | 1328 | "ext4_map_blocks_after_alloc", |
1331 | map->m_lblk, map->m_pblk, | 1329 | map); |
1332 | retval); | ||
1333 | if (ret != 0) | 1330 | if (ret != 0) |
1334 | return ret; | 1331 | return ret; |
1335 | } | 1332 | } |
@@ -4327,10 +4324,9 @@ static int ext4_clear_blocks(handle_t *handle, struct inode *inode, | |||
4327 | 4324 | ||
4328 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free, | 4325 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), block_to_free, |
4329 | count)) { | 4326 | count)) { |
4330 | ext4_error(inode->i_sb, "inode #%lu: " | 4327 | EXT4_ERROR_INODE(inode, "attempt to clear invalid " |
4331 | "attempt to clear blocks %llu len %lu, invalid", | 4328 | "blocks %llu len %lu", |
4332 | inode->i_ino, (unsigned long long) block_to_free, | 4329 | (unsigned long long) block_to_free, count); |
4333 | count); | ||
4334 | return 1; | 4330 | return 1; |
4335 | } | 4331 | } |
4336 | 4332 | ||
@@ -4435,11 +4431,10 @@ static void ext4_free_data(handle_t *handle, struct inode *inode, | |||
4435 | if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh)) | 4431 | if ((EXT4_JOURNAL(inode) == NULL) || bh2jh(this_bh)) |
4436 | ext4_handle_dirty_metadata(handle, inode, this_bh); | 4432 | ext4_handle_dirty_metadata(handle, inode, this_bh); |
4437 | else | 4433 | else |
4438 | ext4_error(inode->i_sb, | 4434 | EXT4_ERROR_INODE(inode, |
4439 | "circular indirect block detected, " | 4435 | "circular indirect block detected at " |
4440 | "inode=%lu, block=%llu", | 4436 | "block %llu", |
4441 | inode->i_ino, | 4437 | (unsigned long long) this_bh->b_blocknr); |
4442 | (unsigned long long) this_bh->b_blocknr); | ||
4443 | } | 4438 | } |
4444 | } | 4439 | } |
4445 | 4440 | ||
@@ -4477,11 +4472,10 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4477 | 4472 | ||
4478 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), | 4473 | if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), |
4479 | nr, 1)) { | 4474 | nr, 1)) { |
4480 | ext4_error(inode->i_sb, | 4475 | EXT4_ERROR_INODE(inode, |
4481 | "indirect mapped block in inode " | 4476 | "invalid indirect mapped " |
4482 | "#%lu invalid (level %d, blk #%lu)", | 4477 | "block %lu (level %d)", |
4483 | inode->i_ino, depth, | 4478 | (unsigned long) nr, depth); |
4484 | (unsigned long) nr); | ||
4485 | break; | 4479 | break; |
4486 | } | 4480 | } |
4487 | 4481 | ||
@@ -4493,9 +4487,9 @@ static void ext4_free_branches(handle_t *handle, struct inode *inode, | |||
4493 | * (should be rare). | 4487 | * (should be rare). |
4494 | */ | 4488 | */ |
4495 | if (!bh) { | 4489 | if (!bh) { |
4496 | ext4_error(inode->i_sb, | 4490 | EXT4_ERROR_INODE(inode, |
4497 | "Read failure, inode=%lu, block=%llu", | 4491 | "Read failure block=%llu", |
4498 | inode->i_ino, nr); | 4492 | (unsigned long long) nr); |
4499 | continue; | 4493 | continue; |
4500 | } | 4494 | } |
4501 | 4495 | ||
@@ -4810,8 +4804,8 @@ static int __ext4_get_inode_loc(struct inode *inode, | |||
4810 | 4804 | ||
4811 | bh = sb_getblk(sb, block); | 4805 | bh = sb_getblk(sb, block); |
4812 | if (!bh) { | 4806 | if (!bh) { |
4813 | ext4_error(sb, "unable to read inode block - " | 4807 | EXT4_ERROR_INODE(inode, "unable to read inode block - " |
4814 | "inode=%lu, block=%llu", inode->i_ino, block); | 4808 | "block %llu", block); |
4815 | return -EIO; | 4809 | return -EIO; |
4816 | } | 4810 | } |
4817 | if (!buffer_uptodate(bh)) { | 4811 | if (!buffer_uptodate(bh)) { |
@@ -4909,8 +4903,8 @@ make_io: | |||
4909 | submit_bh(READ_META, bh); | 4903 | submit_bh(READ_META, bh); |
4910 | wait_on_buffer(bh); | 4904 | wait_on_buffer(bh); |
4911 | if (!buffer_uptodate(bh)) { | 4905 | if (!buffer_uptodate(bh)) { |
4912 | ext4_error(sb, "unable to read inode block - inode=%lu," | 4906 | EXT4_ERROR_INODE(inode, "unable to read inode " |
4913 | " block=%llu", inode->i_ino, block); | 4907 | "block %llu", block); |
4914 | brelse(bh); | 4908 | brelse(bh); |
4915 | return -EIO; | 4909 | return -EIO; |
4916 | } | 4910 | } |
@@ -5121,8 +5115,8 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
5121 | ret = 0; | 5115 | ret = 0; |
5122 | if (ei->i_file_acl && | 5116 | if (ei->i_file_acl && |
5123 | !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { | 5117 | !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { |
5124 | ext4_error(sb, "bad extended attribute block %llu inode #%lu", | 5118 | EXT4_ERROR_INODE(inode, "bad extended attribute block %llu", |
5125 | ei->i_file_acl, inode->i_ino); | 5119 | ei->i_file_acl); |
5126 | ret = -EIO; | 5120 | ret = -EIO; |
5127 | goto bad_inode; | 5121 | goto bad_inode; |
5128 | } else if (ei->i_flags & EXT4_EXTENTS_FL) { | 5122 | } else if (ei->i_flags & EXT4_EXTENTS_FL) { |
@@ -5167,8 +5161,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino) | |||
5167 | new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); | 5161 | new_decode_dev(le32_to_cpu(raw_inode->i_block[1]))); |
5168 | } else { | 5162 | } else { |
5169 | ret = -EIO; | 5163 | ret = -EIO; |
5170 | ext4_error(inode->i_sb, "bogus i_mode (%o) for inode=%lu", | 5164 | EXT4_ERROR_INODE(inode, "bogus i_mode (%o)", inode->i_mode); |
5171 | inode->i_mode, inode->i_ino); | ||
5172 | goto bad_inode; | 5165 | goto bad_inode; |
5173 | } | 5166 | } |
5174 | brelse(iloc.bh); | 5167 | brelse(iloc.bh); |
@@ -5406,9 +5399,9 @@ int ext4_write_inode(struct inode *inode, struct writeback_control *wbc) | |||
5406 | if (wbc->sync_mode == WB_SYNC_ALL) | 5399 | if (wbc->sync_mode == WB_SYNC_ALL) |
5407 | sync_dirty_buffer(iloc.bh); | 5400 | sync_dirty_buffer(iloc.bh); |
5408 | if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { | 5401 | if (buffer_req(iloc.bh) && !buffer_uptodate(iloc.bh)) { |
5409 | ext4_error(inode->i_sb, "IO error syncing inode, " | 5402 | EXT4_ERROR_INODE(inode, |
5410 | "inode=%lu, block=%llu", inode->i_ino, | 5403 | "IO error syncing inode (block=%llu)", |
5411 | (unsigned long long)iloc.bh->b_blocknr); | 5404 | (unsigned long long) iloc.bh->b_blocknr); |
5412 | err = -EIO; | 5405 | err = -EIO; |
5413 | } | 5406 | } |
5414 | brelse(iloc.bh); | 5407 | brelse(iloc.bh); |
diff --git a/fs/ext4/move_extent.c b/fs/ext4/move_extent.c index 82621a360932..b8b8ea1ceda8 100644 --- a/fs/ext4/move_extent.c +++ b/fs/ext4/move_extent.c | |||
@@ -530,7 +530,7 @@ mext_leaf_block(handle_t *handle, struct inode *orig_inode, | |||
530 | * new_ext |-------| | 530 | * new_ext |-------| |
531 | */ | 531 | */ |
532 | if (le32_to_cpu(oext->ee_block) + oext_alen - 1 < new_ext_end) { | 532 | if (le32_to_cpu(oext->ee_block) + oext_alen - 1 < new_ext_end) { |
533 | ext4_error(orig_inode->i_sb, | 533 | EXT4_ERROR_INODE(orig_inode, |
534 | "new_ext_end(%u) should be less than or equal to " | 534 | "new_ext_end(%u) should be less than or equal to " |
535 | "oext->ee_block(%u) + oext_alen(%d) - 1", | 535 | "oext->ee_block(%u) + oext_alen(%d) - 1", |
536 | new_ext_end, le32_to_cpu(oext->ee_block), | 536 | new_ext_end, le32_to_cpu(oext->ee_block), |
@@ -693,12 +693,12 @@ mext_replace_branches(handle_t *handle, struct inode *orig_inode, | |||
693 | while (1) { | 693 | while (1) { |
694 | /* The extent for donor must be found. */ | 694 | /* The extent for donor must be found. */ |
695 | if (!dext) { | 695 | if (!dext) { |
696 | ext4_error(donor_inode->i_sb, | 696 | EXT4_ERROR_INODE(donor_inode, |
697 | "The extent for donor must be found"); | 697 | "The extent for donor must be found"); |
698 | *err = -EIO; | 698 | *err = -EIO; |
699 | goto out; | 699 | goto out; |
700 | } else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) { | 700 | } else if (donor_off != le32_to_cpu(tmp_dext.ee_block)) { |
701 | ext4_error(donor_inode->i_sb, | 701 | EXT4_ERROR_INODE(donor_inode, |
702 | "Donor offset(%u) and the first block of donor " | 702 | "Donor offset(%u) and the first block of donor " |
703 | "extent(%u) should be equal", | 703 | "extent(%u) should be equal", |
704 | donor_off, | 704 | donor_off, |
@@ -1355,7 +1355,7 @@ ext4_move_extents(struct file *o_filp, struct file *d_filp, | |||
1355 | if (ret1 < 0) | 1355 | if (ret1 < 0) |
1356 | break; | 1356 | break; |
1357 | if (*moved_len > len) { | 1357 | if (*moved_len > len) { |
1358 | ext4_error(orig_inode->i_sb, | 1358 | EXT4_ERROR_INODE(orig_inode, |
1359 | "We replaced blocks too much! " | 1359 | "We replaced blocks too much! " |
1360 | "sum of replaced: %llu requested: %llu", | 1360 | "sum of replaced: %llu requested: %llu", |
1361 | *moved_len, len); | 1361 | *moved_len, len); |
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 0c070fabd108..bff77b04f0d1 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c | |||
@@ -943,8 +943,8 @@ restart: | |||
943 | wait_on_buffer(bh); | 943 | wait_on_buffer(bh); |
944 | if (!buffer_uptodate(bh)) { | 944 | if (!buffer_uptodate(bh)) { |
945 | /* read error, skip block & hope for the best */ | 945 | /* read error, skip block & hope for the best */ |
946 | ext4_error(sb, "reading directory #%lu offset %lu", | 946 | EXT4_ERROR_INODE(dir, "reading directory lblock %lu", |
947 | dir->i_ino, (unsigned long)block); | 947 | (unsigned long) block); |
948 | brelse(bh); | 948 | brelse(bh); |
949 | goto next; | 949 | goto next; |
950 | } | 950 | } |
@@ -1066,15 +1066,15 @@ static struct dentry *ext4_lookup(struct inode *dir, struct dentry *dentry, stru | |||
1066 | __u32 ino = le32_to_cpu(de->inode); | 1066 | __u32 ino = le32_to_cpu(de->inode); |
1067 | brelse(bh); | 1067 | brelse(bh); |
1068 | if (!ext4_valid_inum(dir->i_sb, ino)) { | 1068 | if (!ext4_valid_inum(dir->i_sb, ino)) { |
1069 | ext4_error(dir->i_sb, "bad inode number: %u", ino); | 1069 | EXT4_ERROR_INODE(dir, "bad inode number: %u", ino); |
1070 | return ERR_PTR(-EIO); | 1070 | return ERR_PTR(-EIO); |
1071 | } | 1071 | } |
1072 | inode = ext4_iget(dir->i_sb, ino); | 1072 | inode = ext4_iget(dir->i_sb, ino); |
1073 | if (unlikely(IS_ERR(inode))) { | 1073 | if (unlikely(IS_ERR(inode))) { |
1074 | if (PTR_ERR(inode) == -ESTALE) { | 1074 | if (PTR_ERR(inode) == -ESTALE) { |
1075 | ext4_error(dir->i_sb, | 1075 | EXT4_ERROR_INODE(dir, |
1076 | "deleted inode referenced: %u", | 1076 | "deleted inode referenced: %u", |
1077 | ino); | 1077 | ino); |
1078 | return ERR_PTR(-EIO); | 1078 | return ERR_PTR(-EIO); |
1079 | } else { | 1079 | } else { |
1080 | return ERR_CAST(inode); | 1080 | return ERR_CAST(inode); |
@@ -1104,8 +1104,8 @@ struct dentry *ext4_get_parent(struct dentry *child) | |||
1104 | brelse(bh); | 1104 | brelse(bh); |
1105 | 1105 | ||
1106 | if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { | 1106 | if (!ext4_valid_inum(child->d_inode->i_sb, ino)) { |
1107 | ext4_error(child->d_inode->i_sb, | 1107 | EXT4_ERROR_INODE(child->d_inode, |
1108 | "bad inode number: %u", ino); | 1108 | "bad parent inode number: %u", ino); |
1109 | return ERR_PTR(-EIO); | 1109 | return ERR_PTR(-EIO); |
1110 | } | 1110 | } |
1111 | 1111 | ||
@@ -1404,9 +1404,7 @@ static int make_indexed_dir(handle_t *handle, struct dentry *dentry, | |||
1404 | de = (struct ext4_dir_entry_2 *)((char *)fde + | 1404 | de = (struct ext4_dir_entry_2 *)((char *)fde + |
1405 | ext4_rec_len_from_disk(fde->rec_len, blocksize)); | 1405 | ext4_rec_len_from_disk(fde->rec_len, blocksize)); |
1406 | if ((char *) de >= (((char *) root) + blocksize)) { | 1406 | if ((char *) de >= (((char *) root) + blocksize)) { |
1407 | ext4_error(dir->i_sb, | 1407 | EXT4_ERROR_INODE(dir, "invalid rec_len for '..'"); |
1408 | "invalid rec_len for '..' in inode %lu", | ||
1409 | dir->i_ino); | ||
1410 | brelse(bh); | 1408 | brelse(bh); |
1411 | return -EIO; | 1409 | return -EIO; |
1412 | } | 1410 | } |
@@ -1915,9 +1913,8 @@ static int empty_dir(struct inode *inode) | |||
1915 | if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) || | 1913 | if (inode->i_size < EXT4_DIR_REC_LEN(1) + EXT4_DIR_REC_LEN(2) || |
1916 | !(bh = ext4_bread(NULL, inode, 0, 0, &err))) { | 1914 | !(bh = ext4_bread(NULL, inode, 0, 0, &err))) { |
1917 | if (err) | 1915 | if (err) |
1918 | ext4_error(inode->i_sb, | 1916 | EXT4_ERROR_INODE(inode, |
1919 | "error %d reading directory #%lu offset 0", | 1917 | "error %d reading directory lblock 0", err); |
1920 | err, inode->i_ino); | ||
1921 | else | 1918 | else |
1922 | ext4_warning(inode->i_sb, | 1919 | ext4_warning(inode->i_sb, |
1923 | "bad directory (dir #%lu) - no data block", | 1920 | "bad directory (dir #%lu) - no data block", |
@@ -1941,17 +1938,17 @@ static int empty_dir(struct inode *inode) | |||
1941 | de = ext4_next_entry(de1, sb->s_blocksize); | 1938 | de = ext4_next_entry(de1, sb->s_blocksize); |
1942 | while (offset < inode->i_size) { | 1939 | while (offset < inode->i_size) { |
1943 | if (!bh || | 1940 | if (!bh || |
1944 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { | 1941 | (void *) de >= (void *) (bh->b_data+sb->s_blocksize)) { |
1942 | unsigned int lblock; | ||
1945 | err = 0; | 1943 | err = 0; |
1946 | brelse(bh); | 1944 | brelse(bh); |
1947 | bh = ext4_bread(NULL, inode, | 1945 | lblock = offset >> EXT4_BLOCK_SIZE_BITS(sb); |
1948 | offset >> EXT4_BLOCK_SIZE_BITS(sb), 0, &err); | 1946 | bh = ext4_bread(NULL, inode, lblock, 0, &err); |
1949 | if (!bh) { | 1947 | if (!bh) { |
1950 | if (err) | 1948 | if (err) |
1951 | ext4_error(sb, | 1949 | EXT4_ERROR_INODE(inode, |
1952 | "error %d reading directory" | 1950 | "error %d reading directory " |
1953 | " #%lu offset %u", | 1951 | "lblock %u", err, lblock); |
1954 | err, inode->i_ino, offset); | ||
1955 | offset += sb->s_blocksize; | 1952 | offset += sb->s_blocksize; |
1956 | continue; | 1953 | continue; |
1957 | } | 1954 | } |
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c index b4c5aa8489d8..0a09a2e96f0a 100644 --- a/fs/ext4/xattr.c +++ b/fs/ext4/xattr.c | |||
@@ -228,9 +228,8 @@ ext4_xattr_block_get(struct inode *inode, int name_index, const char *name, | |||
228 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 228 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
229 | if (ext4_xattr_check_block(bh)) { | 229 | if (ext4_xattr_check_block(bh)) { |
230 | bad_block: | 230 | bad_block: |
231 | ext4_error(inode->i_sb, | 231 | EXT4_ERROR_INODE(inode, "bad block %llu", |
232 | "inode %lu: bad block %llu", inode->i_ino, | 232 | EXT4_I(inode)->i_file_acl); |
233 | EXT4_I(inode)->i_file_acl); | ||
234 | error = -EIO; | 233 | error = -EIO; |
235 | goto cleanup; | 234 | goto cleanup; |
236 | } | 235 | } |
@@ -372,9 +371,8 @@ ext4_xattr_block_list(struct dentry *dentry, char *buffer, size_t buffer_size) | |||
372 | ea_bdebug(bh, "b_count=%d, refcount=%d", | 371 | ea_bdebug(bh, "b_count=%d, refcount=%d", |
373 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); | 372 | atomic_read(&(bh->b_count)), le32_to_cpu(BHDR(bh)->h_refcount)); |
374 | if (ext4_xattr_check_block(bh)) { | 373 | if (ext4_xattr_check_block(bh)) { |
375 | ext4_error(inode->i_sb, | 374 | EXT4_ERROR_INODE(inode, "bad block %llu", |
376 | "inode %lu: bad block %llu", inode->i_ino, | 375 | EXT4_I(inode)->i_file_acl); |
377 | EXT4_I(inode)->i_file_acl); | ||
378 | error = -EIO; | 376 | error = -EIO; |
379 | goto cleanup; | 377 | goto cleanup; |
380 | } | 378 | } |
@@ -666,8 +664,8 @@ ext4_xattr_block_find(struct inode *inode, struct ext4_xattr_info *i, | |||
666 | atomic_read(&(bs->bh->b_count)), | 664 | atomic_read(&(bs->bh->b_count)), |
667 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); | 665 | le32_to_cpu(BHDR(bs->bh)->h_refcount)); |
668 | if (ext4_xattr_check_block(bs->bh)) { | 666 | if (ext4_xattr_check_block(bs->bh)) { |
669 | ext4_error(sb, "inode %lu: bad block %llu", | 667 | EXT4_ERROR_INODE(inode, "bad block %llu", |
670 | inode->i_ino, EXT4_I(inode)->i_file_acl); | 668 | EXT4_I(inode)->i_file_acl); |
671 | error = -EIO; | 669 | error = -EIO; |
672 | goto cleanup; | 670 | goto cleanup; |
673 | } | 671 | } |
@@ -880,8 +878,8 @@ cleanup_dquot: | |||
880 | goto cleanup; | 878 | goto cleanup; |
881 | 879 | ||
882 | bad_block: | 880 | bad_block: |
883 | ext4_error(inode->i_sb, "inode %lu: bad block %llu", | 881 | EXT4_ERROR_INODE(inode, "bad block %llu", |
884 | inode->i_ino, EXT4_I(inode)->i_file_acl); | 882 | EXT4_I(inode)->i_file_acl); |
885 | goto cleanup; | 883 | goto cleanup; |
886 | 884 | ||
887 | #undef header | 885 | #undef header |
@@ -1194,8 +1192,8 @@ retry: | |||
1194 | if (!bh) | 1192 | if (!bh) |
1195 | goto cleanup; | 1193 | goto cleanup; |
1196 | if (ext4_xattr_check_block(bh)) { | 1194 | if (ext4_xattr_check_block(bh)) { |
1197 | ext4_error(inode->i_sb, "inode %lu: bad block %llu", | 1195 | EXT4_ERROR_INODE(inode, "bad block %llu", |
1198 | inode->i_ino, EXT4_I(inode)->i_file_acl); | 1196 | EXT4_I(inode)->i_file_acl); |
1199 | error = -EIO; | 1197 | error = -EIO; |
1200 | goto cleanup; | 1198 | goto cleanup; |
1201 | } | 1199 | } |
@@ -1372,14 +1370,14 @@ ext4_xattr_delete_inode(handle_t *handle, struct inode *inode) | |||
1372 | goto cleanup; | 1370 | goto cleanup; |
1373 | bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); | 1371 | bh = sb_bread(inode->i_sb, EXT4_I(inode)->i_file_acl); |
1374 | if (!bh) { | 1372 | if (!bh) { |
1375 | ext4_error(inode->i_sb, "inode %lu: block %llu read error", | 1373 | EXT4_ERROR_INODE(inode, "block %llu read error", |
1376 | inode->i_ino, EXT4_I(inode)->i_file_acl); | 1374 | EXT4_I(inode)->i_file_acl); |
1377 | goto cleanup; | 1375 | goto cleanup; |
1378 | } | 1376 | } |
1379 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || | 1377 | if (BHDR(bh)->h_magic != cpu_to_le32(EXT4_XATTR_MAGIC) || |
1380 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { | 1378 | BHDR(bh)->h_blocks != cpu_to_le32(1)) { |
1381 | ext4_error(inode->i_sb, "inode %lu: bad block %llu", | 1379 | EXT4_ERROR_INODE(inode, "bad block %llu", |
1382 | inode->i_ino, EXT4_I(inode)->i_file_acl); | 1380 | EXT4_I(inode)->i_file_acl); |
1383 | goto cleanup; | 1381 | goto cleanup; |
1384 | } | 1382 | } |
1385 | ext4_xattr_release_block(handle, inode, bh); | 1383 | ext4_xattr_release_block(handle, inode, bh); |
@@ -1504,9 +1502,8 @@ again: | |||
1504 | } | 1502 | } |
1505 | bh = sb_bread(inode->i_sb, ce->e_block); | 1503 | bh = sb_bread(inode->i_sb, ce->e_block); |
1506 | if (!bh) { | 1504 | if (!bh) { |
1507 | ext4_error(inode->i_sb, | 1505 | EXT4_ERROR_INODE(inode, "block %lu read error", |
1508 | "inode %lu: block %lu read error", | 1506 | (unsigned long) ce->e_block); |
1509 | inode->i_ino, (unsigned long) ce->e_block); | ||
1510 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= | 1507 | } else if (le32_to_cpu(BHDR(bh)->h_refcount) >= |
1511 | EXT4_XATTR_REFCOUNT_MAX) { | 1508 | EXT4_XATTR_REFCOUNT_MAX) { |
1512 | ea_idebug(inode, "block %lu refcount %d>=%d", | 1509 | ea_idebug(inode, "block %lu refcount %d>=%d", |