summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWei Yongjun <yjwei@cn.fujitsu.com>2009-02-24 12:14:44 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-16 17:32:35 -0700
commit305a27a920b46943dd1518f31d6386414c7fb87e (patch)
treec37e8ae9ec284a5b9d11e9f13cb638d31af1773a
parent54dc90ea5d01776793da82d345c7164ea28f4718 (diff)
downloadlinux-stable-305a27a920b46943dd1518f31d6386414c7fb87e.tar.gz
ext4: Fix to read empty directory blocks correctly in 64k
(cherry picked from commit 7be2baaa0322c59ba888aa5260a8c130666acd41) The rec_len field in the directory entry is 16 bits, so there was a problem representing rec_len for filesystems with a 64k block size in the case where the directory entry takes the entire 64k block. Unfortunately, there were two schemes that were proposed; one where all zeros meant 65536 and one where all ones (65535) meant 65536. E2fsprogs used 0, whereas the kernel used 65535. Oops. Fortunately this case happens extremely rarely, with the most common case being the lost+found directory, created by mke2fs. So we will be liberal in what we accept, and accept both encodings, but we will continue to encode 65536 as 65535. This will require a change in e2fsprogs, but with fortunately ext4 filesystems normally have the dir_index feature enabled, which precludes having a completely empty directory block. Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--fs/ext4/ext4.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/ext4/ext4.h b/fs/ext4/ext4.h
index dfccef55ce0d..0b0c0fac3467 100644
--- a/fs/ext4/ext4.h
+++ b/fs/ext4/ext4.h
@@ -862,7 +862,7 @@ static inline unsigned ext4_rec_len_from_disk(__le16 dlen)
{
unsigned len = le16_to_cpu(dlen);
- if (len == EXT4_MAX_REC_LEN)
+ if (len == EXT4_MAX_REC_LEN || len == 0)
return 1 << 16;
return len;
}