2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-12-21 11:44:01 +08:00

vfs: don't open real

Let overlayfs do its thing when opening a file.

This enables stacking and fixes the corner case when a file is opened for
read, modified through a writable open, and data is read from the read-only
file.  After this patch the read-only open will not return stale data even
in this case.

Signed-off-by: Miklos Szeredi <mszeredi@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Miklos Szeredi 2018-07-06 23:57:06 +02:00
parent 8ede205541
commit a6518f73e6

View File

@ -893,13 +893,8 @@ EXPORT_SYMBOL(file_path);
*/ */
int vfs_open(const struct path *path, struct file *file) int vfs_open(const struct path *path, struct file *file)
{ {
struct dentry *dentry = d_real(path->dentry, NULL, file->f_flags, 0);
if (IS_ERR(dentry))
return PTR_ERR(dentry);
file->f_path = *path; file->f_path = *path;
return do_dentry_open(file, d_backing_inode(dentry), NULL); return do_dentry_open(file, d_backing_inode(path->dentry), NULL);
} }
struct file *dentry_open(const struct path *path, int flags, struct file *dentry_open(const struct path *path, int flags,