Revert "Revert "Android: sdcardfs: Don't do d_add for lower fs""
authorDaniel Rosenberg <drosen@google.com>
Fri, 21 Apr 2017 01:21:50 +0000 (18:21 -0700)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 1 May 2017 09:58:46 +0000 (15:28 +0530)
This reverts commit ffa75fdb9c408f49b9622b6d55752ed99ff61488.

Turns out we just needed the right hash.

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

fs/sdcardfs/lookup.c

index 446ef4027ebcc289d7f8a270628a09a37215f193..509d5fbcb4724c4dd8b325894315ed59d826ccc3 100644 (file)
@@ -373,17 +373,15 @@ put_name:
        lower_dentry = d_hash_and_lookup(lower_dir_dentry, &dname);
        if (IS_ERR(lower_dentry))
                return lower_dentry;
-       if (lower_dentry)
-               goto setup_lower;
-
-       lower_dentry = d_alloc(lower_dir_dentry, &dname);
        if (!lower_dentry) {
-               err = -ENOMEM;
+               /* We called vfs_path_lookup earlier, and did not get a negative
+                * dentry then. Don't confuse the lower filesystem by forcing
+                * one on it now...
+                */
+               err = -ENOENT;
                goto out;
        }
-       d_add(lower_dentry, NULL); /* instantiate and hash */
 
-setup_lower:
        lower_path.dentry = lower_dentry;
        lower_path.mnt = mntget(lower_dir_mnt);
        sdcardfs_set_lower_path(dentry, &lower_path);