fs: store real path instead of fake path in backing file f_path
[linux-2.6-block.git] / fs / open.c
index fe63e236da2225e1ac4579d8b5b41dea06cd51a3..02dc608d40d81f90c9427695763c85d0fd111e93 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -881,7 +881,7 @@ static inline int file_get_write_access(struct file *f)
        if (unlikely(error))
                goto cleanup_inode;
        if (unlikely(f->f_mode & FMODE_BACKING)) {
-               error = mnt_get_write_access(backing_file_real_path(f)->mnt);
+               error = mnt_get_write_access(backing_file_user_path(f)->mnt);
                if (unlikely(error))
                        goto cleanup_mnt;
        }
@@ -1182,20 +1182,19 @@ EXPORT_SYMBOL_GPL(kernel_file_open);
 
 /**
  * backing_file_open - open a backing file for kernel internal use
- * @path:      path of the file to open
+ * @user_path: path that the user reuqested to open
  * @flags:     open flags
  * @real_path: path of the backing file
  * @cred:      credentials for open
  *
  * Open a backing file for a stackable filesystem (e.g., overlayfs).
- * @path may be on the stackable filesystem and backing inode on the
- * underlying filesystem. In this case, we want to be able to return
- * the @real_path of the backing inode. This is done by embedding the
- * returned file into a container structure that also stores the path of
- * the backing inode on the underlying filesystem, which can be
- * retrieved using backing_file_real_path().
+ * @user_path may be on the stackable filesystem and @real_path on the
+ * underlying filesystem.  In this case, we want to be able to return the
+ * @user_path of the stackable filesystem. This is done by embedding the
+ * returned file into a container structure that also stores the stacked
+ * file's path, which can be retrieved using backing_file_user_path().
  */
-struct file *backing_file_open(const struct path *path, int flags,
+struct file *backing_file_open(const struct path *user_path, int flags,
                               const struct path *real_path,
                               const struct cred *cred)
 {
@@ -1206,9 +1205,9 @@ struct file *backing_file_open(const struct path *path, int flags,
        if (IS_ERR(f))
                return f;
 
-       f->f_path = *path;
-       path_get(real_path);
-       *backing_file_real_path(f) = *real_path;
+       path_get(user_path);
+       *backing_file_user_path(f) = *user_path;
+       f->f_path = *real_path;
        error = do_dentry_open(f, d_inode(real_path->dentry), NULL);
        if (error) {
                fput(f);