aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-08 08:21:26 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-08 08:21:26 -0400
commit80e42468d65475e92651e62175bb7807773321d0 (patch)
tree7ab6bd05495a50a4c5fc507ab583daad5178006c
parenta827eaffff07c7d58a4cb32158cbeb4849f4e33a (diff)
ext4: print more sysadmin-friendly message in check_block_validity()
Drop the WARN_ON(1), as he stack trace is not appropriate, since it is triggered by file system corruption, and it misleads users into thinking there is a kernel bug. In addition, change the message displayed by ext4_error() to make it clear that this is a file system corruption problem. Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
-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 5c0d17066f4a..6253ecdac67f 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -1121,16 +1121,15 @@ static void ext4_da_update_reserve_space(struct inode *inode, int used)
1121 ext4_discard_preallocations(inode); 1121 ext4_discard_preallocations(inode);
1122} 1122}
1123 1123
1124static int check_block_validity(struct inode *inode, sector_t logical, 1124static int check_block_validity(struct inode *inode, const char *msg,
1125 sector_t phys, int len) 1125 sector_t logical, sector_t phys, int len)
1126{ 1126{
1127 if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) { 1127 if (!ext4_data_block_valid(EXT4_SB(inode->i_sb), phys, len)) {
1128 ext4_error(inode->i_sb, "check_block_validity", 1128 ext4_error(inode->i_sb, msg,
1129 "inode #%lu logical block %llu mapped to %llu " 1129 "inode #%lu logical block %llu mapped to %llu "
1130 "(size %d)", inode->i_ino, 1130 "(size %d)", inode->i_ino,
1131 (unsigned long long) logical, 1131 (unsigned long long) logical,
1132 (unsigned long long) phys, len); 1132 (unsigned long long) phys, len);
1133 WARN_ON(1);
1134 return -EIO; 1133 return -EIO;
1135 } 1134 }
1136 return 0; 1135 return 0;
@@ -1182,8 +1181,8 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1182 up_read((&EXT4_I(inode)->i_data_sem)); 1181 up_read((&EXT4_I(inode)->i_data_sem));
1183 1182
1184 if (retval > 0 && buffer_mapped(bh)) { 1183 if (retval > 0 && buffer_mapped(bh)) {
1185 int ret = check_block_validity(inode, block, 1184 int ret = check_block_validity(inode, "file system corruption",
1186 bh->b_blocknr, retval); 1185 block, bh->b_blocknr, retval);
1187 if (ret != 0) 1186 if (ret != 0)
1188 return ret; 1187 return ret;
1189 } 1188 }
@@ -1264,8 +1263,9 @@ int ext4_get_blocks(handle_t *handle, struct inode *inode, sector_t block,
1264 1263
1265 up_write((&EXT4_I(inode)->i_data_sem)); 1264 up_write((&EXT4_I(inode)->i_data_sem));
1266 if (retval > 0 && buffer_mapped(bh)) { 1265 if (retval > 0 && buffer_mapped(bh)) {
1267 int ret = check_block_validity(inode, block, 1266 int ret = check_block_validity(inode, "file system "
1268 bh->b_blocknr, retval); 1267 "corruption after allocation",
1268 block, bh->b_blocknr, retval);
1269 if (ret != 0) 1269 if (ret != 0)
1270 return ret; 1270 return ret;
1271 } 1271 }