]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
f2fs: fix up f2fs_get_parent issue to retrieve correct parent inode number
authorNamjae Jeon <namjae.jeon@samsung.com>
Thu, 13 Dec 2012 14:44:11 +0000 (23:44 +0900)
committerJaegeuk Kim <jaegeuk.kim@samsung.com>
Wed, 26 Dec 2012 01:39:52 +0000 (10:39 +0900)
Test Case:
[NFS Client]
ls -lR .

[NFS Server]
while [ 1 ]
do
echo 3 > /proc/sys/vm/drop_caches
done

Error on NFS Client: "No such file or directory"

When cache is dropped at the server, it results in lookup failure at the
NFS client due to non-connection with the parent. The default path is it
initiates a lookup by calculating the hash value for the name, even though
the hash values stored on the disk for "." and ".." is maintained as zero,
which results in failure from find_in_block due to not matching HASH values.
Fix up, by using the correct hashing values for these entries.

Signed-off-by: Namjae Jeon <namjae.jeon@samsung.com>
Signed-off-by: Amit Sahrawat <a.sahrawat@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
fs/f2fs/dir.c
fs/f2fs/hash.c

index b4e24f32b54ee11297d2109aeeb9bd77ce3da63e..e1f66df0f97d1c65a32da3de0cc21fdf0210925d 100644 (file)
@@ -540,13 +540,13 @@ int f2fs_make_empty(struct inode *inode, struct inode *parent)
 
        de = &dentry_blk->dentry[0];
        de->name_len = cpu_to_le16(1);
-       de->hash_code = 0;
+       de->hash_code = f2fs_dentry_hash(".", 1);
        de->ino = cpu_to_le32(inode->i_ino);
        memcpy(dentry_blk->filename[0], ".", 1);
        set_de_type(de, inode);
 
        de = &dentry_blk->dentry[1];
-       de->hash_code = 0;
+       de->hash_code = f2fs_dentry_hash("..", 2);
        de->name_len = cpu_to_le16(2);
        de->ino = cpu_to_le32(parent->i_ino);
        memcpy(dentry_blk->filename[1], "..", 2);
index a60f04200f8badc98e5468367e6cece8354247d1..5e48baca3597e4152ee619af38bf2fb5cfa6431d 100644 (file)
@@ -76,6 +76,10 @@ f2fs_hash_t f2fs_dentry_hash(const char *name, int len)
        const char *p;
        __u32 in[8], buf[4];
 
+       if ((len <= 2) && (name[0] == '.') &&
+               (name[1] == '.' || name[1] == '\0'))
+               return 0;
+
        /* Initialize the default seed for the hash checksum functions */
        buf[0] = 0x67452301;
        buf[1] = 0xefcdab89;