Skip to contentSkip to conversation

ask for help; hash-directory machanism of ext3 cannot work well

DISCUSSION LIOU Payphone 2 participants 4 messages Jun 21, 2007 – Jun 22, 2007

lore
Share & tools
lore
#0 lore raw

firstly, with many thanks! ^-^

my problem :
(1) when i want to format /dev/sda1 to be ext3-filesystem, i set "s_def_hash_version" of "struct ext3_super_block" to be "DX_HASH_LEGACY". when the filesystem was formatted successfully, i mounted it under a directory named "/mnt".
(2) subsequently, i created 40000 empty regular-files under "/mnt" named from "0" to "39999".
(3) then , "ls -li /mnt" was executed; i saw a puzzling thing : there are two indentical entries of the directory named "mnt"! both inode->i_ino and filename are in the same.

32203 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24010 32204 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24011 32205 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24012 32206 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24013 32207 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24014 32208 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24015 32209 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24016 33220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 25027 3220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3090 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220

(4) when i change "DX_HASH_LEGACY" to be "DX_HASH_TEA", the problem listed above not happend.

i scratched my head over it, failed to find any reasonable answers. :-( so, i sent my question to u and expecting eagerly some help from you.

thanks again! :-)
Payphone LIOU

#1 lore raw
Quoted 2 lines · LIOU Payphone

my problem :

First of all, what version of e2fsprogs and kernel are you using?n

Quoted 4 lines

(1) when i want to format /dev/sda1 to be ext3-filesystem, i set "s_def_hash_version" of "struct ext3_super_block" to be "DX_HASH_LEGACY". when the filesystem was formatted successfully, i mounted it under a directory named "/mnt".

How did you set the s_def_hash_version? Were you using debugfs?

And did you turn on the dir_index feature?

With recent versions of e2fsprogs the dir_index feature is enabled default, with DX_HASH_TEA as the default.

Quoted 5 lines

(2) subsequently, i created 40000 empty regular-files under "/mnt" named from "0" to "39999".
(3) then , "ls -li /mnt" was executed; i saw a puzzling thing : there are two indentical entries of the directory named "mnt"! both inode->i_ino and filename are in the same.

Huh? What do you mean by that? Are you seeing two entries named
"mnt" in the /mnt directory? I wasn't able to reproduce this.

Quoted 11 lines

32203 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24010 32204 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24011 32205 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24012 32206 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24013 32207 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24014 32208 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24015 32209 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24016 33220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 25027 3220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3090 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220

You didn't list any "mnt" entries above. So I don't know what you saw.

- Ted

#2 lore raw

Hello, Ted. I think I failed to represent it very well. But many thanks. :-)

What makes me puzzled is there are two entries both named "3220" with ino "3350" were shown under "/mnt" when I "ls -li /mnt".
The version of kernel is 2.6.17-1.2142; and e2fsprogs-1.28.
You know that we can set "s_def_hash_version" to be "DX_HASH_LEAGCY" in function "main{}" of mke2fs.c
But I don't know why the latest version e2fsprogs-1.39 takes "DX_HASH_TEA" for default. Why "DX_HASH_LEAGCY" cannot be taken for default? Could you tell me the reason for it? Thanks. :-)

------

Quoted 2 lines · LIOU Payphone

my problem :

First of all, what version of e2fsprogs and kernel are you using?n

Quoted 4 lines

(1) when i want to format /dev/sda1 to be ext3-filesystem, i set "s_def_hash_version" of "struct ext3_super_block" to be "DX_HASH_LEGACY". when the filesystem was formatted successfully, i mounted it under a directory named "/mnt".

How did you set the s_def_hash_version? Were you using debugfs?

And did you turn on the dir_index feature?

With recent versions of e2fsprogs the dir_index feature is enabled default, with DX_HASH_TEA as the default.

Quoted 4 lines

(2) subsequently, i created 40000 empty regular-files under "/mnt" named from "0" to "39999".
(3) then , "ls -li /mnt" was executed; i saw a puzzling thing : there are two indentical entries under the directory named "mnt"! both inode->i_ino

and

Quoted 1 line

filename are in the same. The filename is 3220 and ino 3350

Huh? What do you mean by that? Are you seeing two entries named
"mnt" in the /mnt directory? I wasn't able to reproduce this.

Quoted 11 lines

32203 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24010 32204 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24011 32205 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24012 32206 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24013 32207 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24014 32208 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24015 32209 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 24016 33220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:37 25027 3220 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3090 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220 3350 -rwxrwxrwx 1 liupf liupf 0 Jun 14 11:31 3220

You didn't list any "mnt" entries above. So I don't know what you saw.

- Ted

#3 lore raw
Quoted 3 lines · LIOU Payphone

What makes me puzzled is there are two entries both named "3220" with ino "3350" were shown under "/mnt" when I "ls -li /mnt".

Hmm. I still can't verify this.

Can you replicate the result? If so, can you send me the output of dumpe2fs?

Quoted 1 line

The version of kernel is 2.6.17-1.2142; and e2fsprogs-1.28.

That looks like a vendor version of the kernel; what distribution are you using?

E2fsprogs 1.28 is a frighteningly old version of e2fsprogs. Did you really mean 1.28? Or 1.38?

Quoted 2 lines

You know that we can set "s_def_hash_version" to be "DX_HASH_LEAGCY" in function "main{}" of mke2fs.c

Oh, so you were modifying your sources to set this variable?

Quoted 3 lines

But I don't know why the latest version e2fsprogs-1.39 takes "DX_HASH_TEA" for default. Why "DX_HASH_LEAGCY" cannot be taken for default? Could you tell me the reason for it? Thanks. :-)

Because DX_HASH_TEA is a better hash, and because it is keyed off of a per-filesystem secret hash value stored in the superblock.

- Ted