ANDROID: sdcardfs: Use filesystem specific hash
authorDaniel Rosenberg <drosen@google.com>
Fri, 21 Apr 2017 01:05:02 +0000 (18:05 -0700)
committerDaniel Rosenberg <drosen@google.com>
Tue, 30 Jan 2018 03:40:09 +0000 (19:40 -0800)
We weren't accounting for FS specific hash functions,
causing us to miss negative dentries for any FS that
had one.

Similar to a patch from esdfs
commit 75bd25a9476d ("esdfs: support lower's own hash")

Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I32d1ba304d728e0ca2648cacfb4c2e441ae63608

fs/sdcardfs/lookup.c

index 126e233654fead18d662167aae71848e5d4aa791..7d7c4515539b9cab40bece14b7d2836477aa77c5 100644 (file)
@@ -366,8 +366,14 @@ put_name:
        /* instatiate a new negative dentry */
        dname.name = name->name;
        dname.len = name->len;
-       dname.hash = full_name_hash(lower_dir_dentry, dname.name, dname.len);
-       lower_dentry = d_lookup(lower_dir_dentry, &dname);
+
+       /* See if the low-level filesystem might want
+        * to use its own hash
+        */
+       lower_dentry = d_hash_and_lookup(lower_dir_dentry, &dname);
+       if (IS_ERR(lower_dentry))
+               return lower_dentry;
+
        if (!lower_dentry) {
                /* We called vfs_path_lookup earlier, and did not get a negative
                 * dentry then. Don't confuse the lower filesystem by forcing