aboutsummaryrefslogtreecommitdiffstats
path: root/fs/overlayfs/file.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/overlayfs/file.c')
-rw-r--r--fs/overlayfs/file.c23
1 files changed, 20 insertions, 3 deletions
diff --git a/fs/overlayfs/file.c b/fs/overlayfs/file.c
index 32e9282893c9..aeaefd2a551b 100644
--- a/fs/overlayfs/file.c
+++ b/fs/overlayfs/file.c
@@ -131,9 +131,6 @@ static int ovl_open(struct inode *inode, struct file *file)
131 if (IS_ERR(realfile)) 131 if (IS_ERR(realfile))
132 return PTR_ERR(realfile); 132 return PTR_ERR(realfile);
133 133
134 /* For O_DIRECT dentry_open() checks f_mapping->a_ops->direct_IO */
135 file->f_mapping = realfile->f_mapping;
136
137 file->private_data = realfile; 134 file->private_data = realfile;
138 135
139 return 0; 136 return 0;
@@ -334,6 +331,25 @@ static long ovl_fallocate(struct file *file, int mode, loff_t offset, loff_t len
334 return ret; 331 return ret;
335} 332}
336 333
334static int ovl_fadvise(struct file *file, loff_t offset, loff_t len, int advice)
335{
336 struct fd real;
337 const struct cred *old_cred;
338 int ret;
339
340 ret = ovl_real_fdget(file, &real);
341 if (ret)
342 return ret;
343
344 old_cred = ovl_override_creds(file_inode(file)->i_sb);
345 ret = vfs_fadvise(real.file, offset, len, advice);
346 revert_creds(old_cred);
347
348 fdput(real);
349
350 return ret;
351}
352
337static long ovl_real_ioctl(struct file *file, unsigned int cmd, 353static long ovl_real_ioctl(struct file *file, unsigned int cmd,
338 unsigned long arg) 354 unsigned long arg)
339{ 355{
@@ -502,6 +518,7 @@ const struct file_operations ovl_file_operations = {
502 .fsync = ovl_fsync, 518 .fsync = ovl_fsync,
503 .mmap = ovl_mmap, 519 .mmap = ovl_mmap,
504 .fallocate = ovl_fallocate, 520 .fallocate = ovl_fallocate,
521 .fadvise = ovl_fadvise,
505 .unlocked_ioctl = ovl_ioctl, 522 .unlocked_ioctl = ovl_ioctl,
506 .compat_ioctl = ovl_compat_ioctl, 523 .compat_ioctl = ovl_compat_ioctl,
507 524