aboutsummaryrefslogtreecommitdiffstats
path: root/fs/ext4/dir.c
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2011-01-10 12:10:55 -0500
committerTheodore Ts'o <tytso@mit.edu>2011-01-10 12:10:55 -0500
commitf7c21177af0b32a2cd9ee36189637f0c1f0e1e17 (patch)
treeba83d4ddcd4b7e15ff575f0b75013ba9ed62f249 /fs/ext4/dir.c
parentf9a62d090cf47fae2fe6f6bd8eb9f24482573fd8 (diff)
ext4: Use ext4_error_file() to print the pathname to the corrupted inode
Where the file pointer is available, use ext4_error_file() instead of ext4_error_inode(). Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs/ext4/dir.c')
-rw-r--r--fs/ext4/dir.c30
1 files changed, 20 insertions, 10 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c
index bd5d74d06399..164c56092e58 100644
--- a/fs/ext4/dir.c
+++ b/fs/ext4/dir.c
@@ -66,7 +66,7 @@ static unsigned char get_dtype(struct super_block *sb, int filetype)
66 * Note: this is the opposite of what ext2 and ext3 historically returned... 66 * Note: this is the opposite of what ext2 and ext3 historically returned...
67 */ 67 */
68int __ext4_check_dir_entry(const char *function, unsigned int line, 68int __ext4_check_dir_entry(const char *function, unsigned int line,
69 struct inode *dir, 69 struct inode *dir, struct file *filp,
70 struct ext4_dir_entry_2 *de, 70 struct ext4_dir_entry_2 *de,
71 struct buffer_head *bh, 71 struct buffer_head *bh,
72 unsigned int offset) 72 unsigned int offset)
@@ -90,12 +90,21 @@ int __ext4_check_dir_entry(const char *function, unsigned int line,
90 else 90 else
91 return 0; 91 return 0;
92 92
93 ext4_error_inode(dir, function, line, bh->b_blocknr, 93 if (filp)
94 "bad entry in directory: %s - " 94 ext4_error_file(filp, function, line, bh ? bh->b_blocknr : 0,
95 "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d", 95 "bad entry in directory: %s - offset=%u(%u), "
96 error_msg, (unsigned) (offset%bh->b_size), offset, 96 "inode=%u, rec_len=%d, name_len=%d",
97 le32_to_cpu(de->inode), 97 error_msg, (unsigned) (offset%bh->b_size),
98 rlen, de->name_len); 98 offset, le32_to_cpu(de->inode),
99 rlen, de->name_len);
100 else
101 ext4_error_inode(dir, function, line, bh ? bh->b_blocknr : 0,
102 "bad entry in directory: %s - offset=%u(%u), "
103 "inode=%u, rec_len=%d, name_len=%d",
104 error_msg, (unsigned) (offset%bh->b_size),
105 offset, le32_to_cpu(de->inode),
106 rlen, de->name_len);
107
99 return 1; 108 return 1;
100} 109}
101 110
@@ -158,8 +167,9 @@ static int ext4_readdir(struct file *filp,
158 */ 167 */
159 if (!bh) { 168 if (!bh) {
160 if (!dir_has_error) { 169 if (!dir_has_error) {
161 EXT4_ERROR_INODE(inode, "directory " 170 EXT4_ERROR_FILE(filp, 0,
162 "contains a hole at offset %Lu", 171 "directory contains a "
172 "hole at offset %llu",
163 (unsigned long long) filp->f_pos); 173 (unsigned long long) filp->f_pos);
164 dir_has_error = 1; 174 dir_has_error = 1;
165 } 175 }
@@ -200,7 +210,7 @@ revalidate:
200 while (!error && filp->f_pos < inode->i_size 210 while (!error && filp->f_pos < inode->i_size
201 && offset < sb->s_blocksize) { 211 && offset < sb->s_blocksize) {
202 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset); 212 de = (struct ext4_dir_entry_2 *) (bh->b_data + offset);
203 if (ext4_check_dir_entry(inode, de, 213 if (ext4_check_dir_entry(inode, filp, de,
204 bh, offset)) { 214 bh, offset)) {
205 /* 215 /*
206 * On error, skip the f_pos to the next block 216 * On error, skip the f_pos to the next block