diff options
author | Darrick J. Wong <darrick.wong@oracle.com> | 2012-11-12 23:51:02 -0500 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2012-11-12 23:51:02 -0500 |
commit | c6af8803cd4f56aa62a47448c55030d4905b6783 (patch) | |
tree | db474fa8ae82cf4f4ca56294cf92a2ee422179fc /fs | |
parent | dffe9d8da715bed4d395883add90a2d150d85729 (diff) |
ext4: don't verify checksums of dx non-leaf nodes during fallback scan
During a directory entry lookup of a hashed directory, if the
hash-based lookup functions fail and we fall back to a linear scan,
don't try to verify the dirent checksum on the internal nodes of the
hash tree because they don't store a checksum in a hidden dirent like
the leaf nodes do.
Reported-by: George Spelvin <linux@horizon.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/ext4/namei.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/fs/ext4/namei.c b/fs/ext4/namei.c index 580af3dfc0eb..88e9a2c7e328 100644 --- a/fs/ext4/namei.c +++ b/fs/ext4/namei.c @@ -1146,6 +1146,21 @@ static inline int search_dirblock(struct buffer_head *bh, return 0; } +static int is_dx_internal_node(struct inode *dir, ext4_lblk_t block, + struct ext4_dir_entry *de) +{ + struct super_block *sb = dir->i_sb; + + if (!is_dx(dir)) + return 0; + if (block == 0) + return 1; + if (de->inode == 0 && + ext4_rec_len_from_disk(de->rec_len, sb->s_blocksize) == + sb->s_blocksize) + return 1; + return 0; +} /* * ext4_find_entry() @@ -1246,6 +1261,8 @@ restart: goto next; } if (!buffer_verified(bh) && + !is_dx_internal_node(dir, block, + (struct ext4_dir_entry *)bh->b_data) && !ext4_dirent_csum_verify(dir, (struct ext4_dir_entry *)bh->b_data)) { EXT4_ERROR_INODE(dir, "checksumming directory " |