diff options
Diffstat (limited to 'fs/ext4/dir.c')
-rw-r--r-- | fs/ext4/dir.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/fs/ext4/dir.c b/fs/ext4/dir.c index ea5e6cb7e2a5..374510f72baa 100644 --- a/fs/ext4/dir.c +++ b/fs/ext4/dir.c | |||
@@ -61,10 +61,11 @@ static unsigned char get_dtype(struct super_block *sb, int filetype) | |||
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | int ext4_check_dir_entry(const char *function, struct inode *dir, | 64 | int __ext4_check_dir_entry(const char *function, unsigned int line, |
65 | struct ext4_dir_entry_2 *de, | 65 | struct inode *dir, |
66 | struct buffer_head *bh, | 66 | struct ext4_dir_entry_2 *de, |
67 | unsigned int offset) | 67 | struct buffer_head *bh, |
68 | unsigned int offset) | ||
68 | { | 69 | { |
69 | const char *error_msg = NULL; | 70 | const char *error_msg = NULL; |
70 | const int rlen = ext4_rec_len_from_disk(de->rec_len, | 71 | const int rlen = ext4_rec_len_from_disk(de->rec_len, |
@@ -83,11 +84,10 @@ int ext4_check_dir_entry(const char *function, struct inode *dir, | |||
83 | error_msg = "inode out of bounds"; | 84 | error_msg = "inode out of bounds"; |
84 | 85 | ||
85 | if (error_msg != NULL) | 86 | if (error_msg != NULL) |
86 | ext4_error_inode(function, dir, | 87 | ext4_error_inode(dir, function, line, bh->b_blocknr, |
87 | "bad entry in directory: %s - block=%llu" | 88 | "bad entry in directory: %s - " |
88 | "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d", | 89 | "offset=%u(%u), inode=%u, rec_len=%d, name_len=%d", |
89 | error_msg, (unsigned long long) bh->b_blocknr, | 90 | error_msg, (unsigned) (offset%bh->b_size), offset, |
90 | (unsigned) (offset%bh->b_size), offset, | ||
91 | le32_to_cpu(de->inode), | 91 | le32_to_cpu(de->inode), |
92 | rlen, de->name_len); | 92 | rlen, de->name_len); |
93 | return error_msg == NULL ? 1 : 0; | 93 | return error_msg == NULL ? 1 : 0; |
@@ -121,7 +121,8 @@ static int ext4_readdir(struct file *filp, | |||
121 | * We don't set the inode dirty flag since it's not | 121 | * We don't set the inode dirty flag since it's not |
122 | * critical that it get flushed back to the disk. | 122 | * critical that it get flushed back to the disk. |
123 | */ | 123 | */ |
124 | ext4_clear_inode_flag(filp->f_path.dentry->d_inode, EXT4_INODE_INDEX); | 124 | ext4_clear_inode_flag(filp->f_path.dentry->d_inode, |
125 | EXT4_INODE_INDEX); | ||
125 | } | 126 | } |
126 | stored = 0; | 127 | stored = 0; |
127 | offset = filp->f_pos & (sb->s_blocksize - 1); | 128 | offset = filp->f_pos & (sb->s_blocksize - 1); |
@@ -193,7 +194,7 @@ revalidate: | |||
193 | while (!error && filp->f_pos < inode->i_size | 194 | while (!error && filp->f_pos < inode->i_size |
194 | && offset < sb->s_blocksize) { | 195 | && offset < sb->s_blocksize) { |
195 | de = (struct ext4_dir_entry_2 *) (bh->b_data + offset); | 196 | de = (struct ext4_dir_entry_2 *) (bh->b_data + offset); |
196 | if (!ext4_check_dir_entry("ext4_readdir", inode, de, | 197 | if (!ext4_check_dir_entry(inode, de, |
197 | bh, offset)) { | 198 | bh, offset)) { |
198 | /* | 199 | /* |
199 | * On error, skip the f_pos to the next block | 200 | * On error, skip the f_pos to the next block |
@@ -343,7 +344,7 @@ int ext4_htree_store_dirent(struct file *dir_file, __u32 hash, | |||
343 | struct dir_private_info *info; | 344 | struct dir_private_info *info; |
344 | int len; | 345 | int len; |
345 | 346 | ||
346 | info = (struct dir_private_info *) dir_file->private_data; | 347 | info = dir_file->private_data; |
347 | p = &info->root.rb_node; | 348 | p = &info->root.rb_node; |
348 | 349 | ||
349 | /* Create and allocate the fname structure */ | 350 | /* Create and allocate the fname structure */ |