Permalink
Browse files

hostfs: fix opening file with overlayfs

If a file on overlayfs using hostfs as a lowerdir is opened, it would
be failed by ENOENT because hostfs resolves a host path by a host root
path stored on the hostfs superblock referred by file->f_path.dentry,
but it is replaced with overlayfs's one starting from the
commit 4bacc9c ("overlayfs: Make f_path always point to the
overlay and f_inode to the underlay").

We replace using file->f_path.dentry directly with calling
"file_dentry" from a commit d101a12 ("fs: add file_dentry()") to
fix the issue.

Signed-off-by: Toshikuni Fukaya <toshiq2@gmail.com>
  • Loading branch information...
toshipp committed May 1, 2016
1 parent da9373d commit 17acb8bfdb771e3a57e14a7ba7274065530c31b3
Showing with 2 additions and 2 deletions.
  1. +2 −2 fs/hostfs/hostfs_kern.c
View
@@ -284,7 +284,7 @@ static int hostfs_readdir(struct file *file, struct dir_context *ctx)
int error, len;
unsigned int type;
- name = dentry_name(file->f_path.dentry);
+ name = dentry_name(file_dentry(file));
if (name == NULL)
return -ENOMEM;
dir = open_dir(name, &error);
@@ -323,7 +323,7 @@ static int hostfs_open(struct inode *ino, struct file *file)
if (mode & FMODE_WRITE)
r = w = 1;
- name = dentry_name(file->f_path.dentry);
+ name = dentry_name(file_dentry(file));
if (name == NULL)
return -ENOMEM;

0 comments on commit 17acb8b

Please sign in to comment.