summaryrefslogtreecommitdiff
path: root/fs/overlayfs/inode.c
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@redhat.com>2016-07-27 12:36:03 +0300
committerMiklos Szeredi <mszeredi@redhat.com>2016-07-27 12:36:03 +0300
commit1b91dbdd2938a0102fea2d8853073159f2b08deb (patch)
tree6c1c54e4b15a1efbcd15a4d68d6366c71abf9979 /fs/overlayfs/inode.c
parent523d939ef98fd712632d93a5a2b588e477a7565e (diff)
parent0cac643c102c0632dc2cc81e2490b0fec1cac0af (diff)
downloadlinux-1b91dbdd2938a0102fea2d8853073159f2b08deb.tar.xz
Merge branch 'd_real' into overlayfs-next
Diffstat (limited to 'fs/overlayfs/inode.c')
-rw-r--r--fs/overlayfs/inode.c31
1 files changed, 10 insertions, 21 deletions
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index d1cdc60dd68f..d554e86abbe3 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -351,36 +351,25 @@ static bool ovl_open_need_copy_up(int flags, enum ovl_path_type type,
return true;
}
-struct inode *ovl_d_select_inode(struct dentry *dentry, unsigned file_flags)
+int ovl_open_maybe_copy_up(struct dentry *dentry, unsigned int file_flags)
{
- int err;
+ int err = 0;
struct path realpath;
enum ovl_path_type type;
- if (d_is_dir(dentry))
- return d_backing_inode(dentry);
-
type = ovl_path_real(dentry, &realpath);
if (ovl_open_need_copy_up(file_flags, type, realpath.dentry)) {
err = ovl_want_write(dentry);
- if (err)
- return ERR_PTR(err);
-
- if (file_flags & O_TRUNC)
- err = ovl_copy_up_truncate(dentry);
- else
- err = ovl_copy_up(dentry);
- ovl_drop_write(dentry);
- if (err)
- return ERR_PTR(err);
-
- ovl_path_upper(dentry, &realpath);
+ if (!err) {
+ if (file_flags & O_TRUNC)
+ err = ovl_copy_up_truncate(dentry);
+ else
+ err = ovl_copy_up(dentry);
+ ovl_drop_write(dentry);
+ }
}
- if (realpath.dentry->d_flags & DCACHE_OP_SELECT_INODE)
- return realpath.dentry->d_op->d_select_inode(realpath.dentry, file_flags);
-
- return d_backing_inode(realpath.dentry);
+ return err;
}
static const struct inode_operations ovl_file_inode_operations = {