]> git.ipfire.org Git - thirdparty/kernel/linux.git/blobdiff - fs/overlayfs/super.c
fs: store real path instead of fake path in backing file f_path
[thirdparty/kernel/linux.git] / fs / overlayfs / super.c
index def266b5e2a33b0aa630662286827227f952e513..9f43f0d303ad786f0f5d43b19995d2990450019e 100644 (file)
@@ -34,14 +34,22 @@ static struct dentry *ovl_d_real(struct dentry *dentry,
        struct dentry *real = NULL, *lower;
        int err;
 
-       /* It's an overlay file */
+       /*
+        * vfs is only expected to call d_real() with NULL from d_real_inode()
+        * and with overlay inode from file_dentry() on an overlay file.
+        *
+        * TODO: remove @inode argument from d_real() API, remove code in this
+        * function that deals with non-NULL @inode and remove d_real() call
+        * from file_dentry().
+        */
        if (inode && d_inode(dentry) == inode)
                return dentry;
+       else if (inode)
+               goto bug;
 
        if (!d_is_reg(dentry)) {
-               if (!inode || inode == d_inode(dentry))
-                       return dentry;
-               goto bug;
+               /* d_real_inode() is only relevant for regular files */
+               return dentry;
        }
 
        real = ovl_dentry_upper(dentry);