Commit eeaa31cc authored by Alex Tomas's avatar Alex Tomas Committed by Linus Torvalds

[PATCH] ext3: htree readdir fix

I've observed that ext3_htree_fill_tree() doesn't ignore empty records
(de->inode == 0).  test case is very simple: turn htree on, create several
hundreds of files, remove them and look at strace ls:

[root@victim tests]# ls -a /test/1
.  ..

[root@victim tests]# strace ls /test/1/
....
getdents64(3, /* 18 entries */, 4096)   = 432
getdents64(3, /* 0 entries */, 4096)    = 0
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 268ae31b
...@@ -557,6 +557,8 @@ static int htree_dirblock_to_tree(struct file *dir_file, ...@@ -557,6 +557,8 @@ static int htree_dirblock_to_tree(struct file *dir_file,
((hinfo->hash == start_hash) && ((hinfo->hash == start_hash) &&
(hinfo->minor_hash < start_minor_hash))) (hinfo->minor_hash < start_minor_hash)))
continue; continue;
if (de->inode == 0)
continue;
if ((err = ext3_htree_store_dirent(dir_file, if ((err = ext3_htree_store_dirent(dir_file,
hinfo->hash, hinfo->minor_hash, de)) != 0) { hinfo->hash, hinfo->minor_hash, de)) != 0) {
brelse(bh); brelse(bh);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment