aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/inode.c
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2015-10-17 16:16:04 -0400
committerTheodore Ts'o <tytso@mit.edu>2015-10-17 16:16:04 -0400
commit6a797d2737838906f2ea0a31686e87c3151e21ca (patch)
treec13f506c771271660fb76d3e0ba86a9e107f0ed9 /fs/ext4/inode.c
parent8c81bd8f586c46eaf114758a78d82895a2b081c2 (diff)
ext4: call out CRC and corruption errors with specific error codes
Instead of overloading EIO for CRC errors and corrupt structures, return the same error codes that XFS returns for the same issues. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/inode.c')
-rw-r--r--fs/ext4/inode.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index f205ac3c4e41..2b9278867caf 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -378,7 +378,7 @@ static int __check_block_validity(struct inode *inode, const char *func,
378 "lblock %lu mapped to illegal pblock " 378 "lblock %lu mapped to illegal pblock "
379 "(length %d)", (unsigned long) map->m_lblk, 379 "(length %d)", (unsigned long) map->m_lblk,
380 map->m_len); 380 map->m_len);
381 return -EIO; 381 return -EFSCORRUPTED;
382 } 382 }
383 return 0; 383 return 0;
384} 384}
@@ -480,7 +480,7 @@ int ext4_map_blocks(handle_t *handle, struct inode *inode,
480 480
481 /* We can handle the block number less than EXT_MAX_BLOCKS */ 481 /* We can handle the block number less than EXT_MAX_BLOCKS */
482 if (unlikely(map->m_lblk >= EXT_MAX_BLOCKS)) 482 if (unlikely(map->m_lblk >= EXT_MAX_BLOCKS))
483 return -EIO; 483 return -EFSCORRUPTED;
484 484
485 /* Lookup extent status tree firstly */ 485 /* Lookup extent status tree firstly */
486 if (ext4_es_lookup_extent(inode, map->m_lblk, &es)) { 486 if (ext4_es_lookup_extent(inode, map->m_lblk, &es)) {
@@ -3863,7 +3863,7 @@ static int __ext4_get_inode_loc(struct inode *inode,
3863 3863
3864 iloc->bh = NULL; 3864 iloc->bh = NULL;
3865 if (!ext4_valid_inum(sb, inode->i_ino)) 3865 if (!ext4_valid_inum(sb, inode->i_ino))
3866 return -EIO; 3866 return -EFSCORRUPTED;
3867 3867
3868 iloc->block_group = (inode->i_ino - 1) / EXT4_INODES_PER_GROUP(sb); 3868 iloc->block_group = (inode->i_ino - 1) / EXT4_INODES_PER_GROUP(sb);
3869 gdp = ext4_get_group_desc(sb, iloc->block_group, NULL); 3869 gdp = ext4_get_group_desc(sb, iloc->block_group, NULL);
@@ -4111,7 +4111,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4111 EXT4_ERROR_INODE(inode, "bad extra_isize (%u != %u)", 4111 EXT4_ERROR_INODE(inode, "bad extra_isize (%u != %u)",
4112 EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize, 4112 EXT4_GOOD_OLD_INODE_SIZE + ei->i_extra_isize,
4113 EXT4_INODE_SIZE(inode->i_sb)); 4113 EXT4_INODE_SIZE(inode->i_sb));
4114 ret = -EIO; 4114 ret = -EFSCORRUPTED;
4115 goto bad_inode; 4115 goto bad_inode;
4116 } 4116 }
4117 } else 4117 } else
@@ -4131,7 +4131,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4131 4131
4132 if (!ext4_inode_csum_verify(inode, raw_inode, ei)) { 4132 if (!ext4_inode_csum_verify(inode, raw_inode, ei)) {
4133 EXT4_ERROR_INODE(inode, "checksum invalid"); 4133 EXT4_ERROR_INODE(inode, "checksum invalid");
4134 ret = -EIO; 4134 ret = -EFSBADCRC;
4135 goto bad_inode; 4135 goto bad_inode;
4136 } 4136 }
4137 4137
@@ -4246,7 +4246,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4246 !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) { 4246 !ext4_data_block_valid(EXT4_SB(sb), ei->i_file_acl, 1)) {
4247 EXT4_ERROR_INODE(inode, "bad extended attribute block %llu", 4247 EXT4_ERROR_INODE(inode, "bad extended attribute block %llu",
4248 ei->i_file_acl); 4248 ei->i_file_acl);
4249 ret = -EIO; 4249 ret = -EFSCORRUPTED;
4250 goto bad_inode; 4250 goto bad_inode;
4251 } else if (!ext4_has_inline_data(inode)) { 4251 } else if (!ext4_has_inline_data(inode)) {
4252 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) { 4252 if (ext4_test_inode_flag(inode, EXT4_INODE_EXTENTS)) {
@@ -4297,7 +4297,7 @@ struct inode *ext4_iget(struct super_block *sb, unsigned long ino)
4297 } else if (ino == EXT4_BOOT_LOADER_INO) { 4297 } else if (ino == EXT4_BOOT_LOADER_INO) {
4298 make_bad_inode(inode); 4298 make_bad_inode(inode);
4299 } else { 4299 } else {
4300 ret = -EIO; 4300 ret = -EFSCORRUPTED;
4301 EXT4_ERROR_INODE(inode, "bogus i_mode (%o)", inode->i_mode); 4301 EXT4_ERROR_INODE(inode, "bogus i_mode (%o)", inode->i_mode);
4302 goto bad_inode; 4302 goto bad_inode;
4303 } 4303 }
@@ -4315,7 +4315,7 @@ bad_inode:
4315struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino) 4315struct inode *ext4_iget_normal(struct super_block *sb, unsigned long ino)
4316{ 4316{
4317 if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO) 4317 if (ino < EXT4_FIRST_INO(sb) && ino != EXT4_ROOT_INO)
4318 return ERR_PTR(-EIO); 4318 return ERR_PTR(-EFSCORRUPTED);
4319 return ext4_iget(sb, ino); 4319 return ext4_iget(sb, ino);
4320} 4320}
4321 4321