Revert "Android: sdcardfs: Don't do d_add for lower fs"
This reverts commit ab16e2fd5e8966ade74206c716a1335493586575.
This change caused issues for sdcardfs on top of vfat
Signed-off-by: Daniel Rosenberg <drosen@google.com>
Change-Id: I34918eed57a8b566c58f8083de12a93a12ba5857
diff --git a/fs/sdcardfs/lookup.c b/fs/sdcardfs/lookup.c
index 751e3a6..19154b7 100644
--- a/fs/sdcardfs/lookup.c
+++ b/fs/sdcardfs/lookup.c
@@ -368,15 +368,17 @@
dname.len = name->len;
dname.hash = full_name_hash(lower_dir_dentry, dname.name, dname.len);
lower_dentry = d_lookup(lower_dir_dentry, &dname);
+ if (lower_dentry)
+ goto setup_lower;
+
+ lower_dentry = d_alloc(lower_dir_dentry, &dname);
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 one
- * on it now...
- */
- err = -ENOENT;
+ err = -ENOMEM;
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);