@@ -747,7 +747,7 @@ const struct file_operations cifs_file_ops = {
.fsync = cifs_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
- .splice_read = generic_file_splice_read,
+ .splice_read = cifs_file_splice_read,
.llseek = cifs_llseek,
#ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl,
@@ -769,7 +769,7 @@ const struct file_operations cifs_file_direct_ops = {
.fsync = cifs_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
- .splice_read = generic_file_splice_read,
+ .splice_read = cifs_file_splice_read,
#ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */
@@ -788,7 +788,7 @@ const struct file_operations cifs_file_nobrl_ops = {
.fsync = cifs_fsync,
.flush = cifs_flush,
.mmap = cifs_file_mmap,
- .splice_read = generic_file_splice_read,
+ .splice_read = cifs_file_splice_read,
.llseek = cifs_llseek,
#ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl,
@@ -808,7 +808,7 @@ const struct file_operations cifs_file_direct_nobrl_ops = {
.release = cifs_close,
.fsync = cifs_fsync,
.flush = cifs_flush,
- .splice_read = generic_file_splice_read,
+ .splice_read = cifs_file_splice_read,
#ifdef CONFIG_CIFS_POSIX
.unlocked_ioctl = cifs_ioctl,
#endif /* CONFIG_CIFS_POSIX */
@@ -86,6 +86,9 @@ extern ssize_t cifs_user_write(struct file *file, const char __user *write_data,
extern int cifs_lock(struct file *, int, struct file_lock *);
extern int cifs_fsync(struct file *, struct dentry *, int);
extern int cifs_flush(struct file *, fl_owner_t id);
+extern ssize_t cifs_file_splice_read(struct file *filp, loff_t *ppos,
+ struct pipe_inode_info *pipe, size_t count,
+ unsigned int flags);
extern ssize_t cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos);
extern int cifs_file_mmap(struct file * , struct vm_area_struct *);
@@ -1889,6 +1889,25 @@ static ssize_t cifs_read(struct file *file, char *read_data, size_t read_size,
}
ssize_t
+cifs_file_splice_read(struct file *filp, loff_t *ppos,
+ struct pipe_inode_info *pipe, size_t count,
+ unsigned int flags)
+{
+ int rc;
+ struct dentry *dentry = filp->f_path.dentry;
+
+ cFYI(1, ("%s: splice_read(%s/%s, %lu@%Lu)\n", __func__,
+ dentry->d_parent->d_name.name, dentry->d_name.name,
+ (unsigned long) count, (unsigned long long) *ppos));
+
+ rc = cifs_revalidate_file(filp);
+ if (rc)
+ return rc;
+
+ return generic_file_splice_read(filp, ppos, pipe, count, flags);
+}
+
+ssize_t
cifs_file_aio_read(struct kiocb *iocb, const struct iovec *iov,
unsigned long nr_segs, loff_t pos)
{
Ensure that inode attributes are revalidated prior to a cache read. Signed-off-by: Jeff Layton <jlayton@redhat.com> --- fs/cifs/cifsfs.c | 8 ++++---- fs/cifs/cifsfs.h | 3 +++ fs/cifs/file.c | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-)