]> git.kernelconcepts.de Git - karo-tx-linux.git/commit
ext4: fix readdir error in the case of inline_data+dir_index
authorTao Ma <boyu.mt@taobao.com>
Fri, 19 Apr 2013 21:53:09 +0000 (17:53 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Fri, 19 Apr 2013 21:53:09 +0000 (17:53 -0400)
commit8af0f08227977079f8f227e74d27c59db2ab84f6
tree8db354c62e7d529bf4b5cdb0f2800a065cc1cd20
parent28daf4fae8693d4a285123494899fe01950cba50
ext4: fix readdir error in the case of inline_data+dir_index

Zach reported a problem that if inline data is enabled, we don't
tell the difference between the offset of '.' and '..'. And a
getdents will fail if the user only want to get '.' and what's worse,
if there is a conversion happens when the user calls getdents
many times, he/she may get the same entry twice.

In theory, a dir block would also fail if it is converted to a
hashed-index based dir since f_pos will become a hash value, not the
real one, but it doesn't happen.  And a deep investigation shows that
we uses a hash based solution even for a normal dir if the dir_index
feature is enabled.

So this patch just adds a new htree_inlinedir_to_tree for inline dir,
and if we find that the hash index is supported, we will do like what
we do for a dir block.

Reported-by: Zach Brown <zab@redhat.com>
Signed-off-by: Tao Ma <boyu.mt@taobao.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
fs/ext4/dir.c
fs/ext4/ext4.h
fs/ext4/inline.c
fs/ext4/namei.c