diff options
-rw-r--r-- | fs/f2fs/dir.c | 4 | ||||
-rw-r--r-- | fs/f2fs/hash.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/dir.c b/fs/f2fs/dir.c index b4e24f32b54e..e1f66df0f97d 100644 --- a/fs/f2fs/dir.c +++ b/fs/f2fs/dir.c | |||
@@ -540,13 +540,13 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent) | |||
540 | 540 | ||
541 | de = &dentry_blk->dentry[0]; | 541 | de = &dentry_blk->dentry[0]; |
542 | de->name_len = cpu_to_le16(1); | 542 | de->name_len = cpu_to_le16(1); |
543 | de->hash_code = 0; | 543 | de->hash_code = f2fs_dentry_hash(".", 1); |
544 | de->ino = cpu_to_le32(inode->i_ino); | 544 | de->ino = cpu_to_le32(inode->i_ino); |
545 | memcpy(dentry_blk->filename[0], ".", 1); | 545 | memcpy(dentry_blk->filename[0], ".", 1); |
546 | set_de_type(de, inode); | 546 | set_de_type(de, inode); |
547 | 547 | ||
548 | de = &dentry_blk->dentry[1]; | 548 | de = &dentry_blk->dentry[1]; |
549 | de->hash_code = 0; | 549 | de->hash_code = f2fs_dentry_hash("..", 2); |
550 | de->name_len = cpu_to_le16(2); | 550 | de->name_len = cpu_to_le16(2); |
551 | de->ino = cpu_to_le32(parent->i_ino); | 551 | de->ino = cpu_to_le32(parent->i_ino); |
552 | memcpy(dentry_blk->filename[1], "..", 2); | 552 | memcpy(dentry_blk->filename[1], "..", 2); |
diff --git a/fs/f2fs/hash.c b/fs/f2fs/hash.c index a60f04200f8b..5e48baca3597 100644 --- a/fs/f2fs/hash.c +++ b/fs/f2fs/hash.c | |||
@@ -76,6 +76,10 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, int len) | |||
76 | const char *p; | 76 | const char *p; |
77 | __u32 in[8], buf[4]; | 77 | __u32 in[8], buf[4]; |
78 | 78 | ||
79 | if ((len <= 2) && (name[0] == '.') && | ||
80 | (name[1] == '.' || name[1] == '\0')) | ||
81 | return 0; | ||
82 | |||
79 | /* Initialize the default seed for the hash checksum functions */ | 83 | /* Initialize the default seed for the hash checksum functions */ |
80 | buf[0] = 0x67452301; | 84 | buf[0] = 0x67452301; |
81 | buf[1] = 0xefcdab89; | 85 | buf[1] = 0xefcdab89; |