From patchwork Thu Feb 11 19:58:49 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jeff Layton X-Patchwork-Id: 45151 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.samba.org (fn.samba.org [216.83.154.106]) by ozlabs.org (Postfix) with ESMTP id 6AA2CB7D06 for ; Fri, 12 Feb 2010 06:59:26 +1100 (EST) Received: from fn.samba.org (localhost [127.0.0.1]) by lists.samba.org (Postfix) with ESMTP id B309846599; Thu, 11 Feb 2010 13:10:34 -0700 (MST) X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on fn.samba.org X-Spam-Level: X-Spam-Status: No, score=-8.9 required=3.8 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.2.5 X-Original-To: linux-cifs-client@lists.samba.org Delivered-To: linux-cifs-client@lists.samba.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by lists.samba.org (Postfix) with ESMTP id 86669AD090 for ; Thu, 11 Feb 2010 13:10:13 -0700 (MST) Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o1BJwvTt017984 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 11 Feb 2010 14:58:57 -0500 Received: from localhost.localdomain (barsoom.rdu.redhat.com [10.11.228.36]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o1BJwoUM001909; Thu, 11 Feb 2010 14:58:57 -0500 From: Jeff Layton To: smfrench@gmail.com Date: Thu, 11 Feb 2010 14:58:49 -0500 Message-Id: <1265918330-2810-8-git-send-email-jlayton@redhat.com> In-Reply-To: <1265918330-2810-1-git-send-email-jlayton@redhat.com> References: <1265918330-2810-1-git-send-email-jlayton@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 Cc: petr@vandrovec.name, linux-cifs-client@lists.samba.org Subject: [linux-cifs-client] [PATCH 7/8] cifs: add revalidation wrapper for splice_read X-BeenThere: linux-cifs-client@lists.samba.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: The Linux CIFS VFS client List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-cifs-client-bounces@lists.samba.org Errors-To: linux-cifs-client-bounces@lists.samba.org Ensure that inode attributes are revalidated prior to a cache read. Signed-off-by: Jeff Layton --- fs/cifs/cifsfs.c | 8 ++++---- fs/cifs/cifsfs.h | 3 +++ fs/cifs/file.c | 19 +++++++++++++++++++ 3 files changed, 26 insertions(+), 4 deletions(-) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index 9f1d94e..ddafac4 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -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 */ diff --git a/fs/cifs/cifsfs.h b/fs/cifs/cifsfs.h index c7eac06..57eae81 100644 --- a/fs/cifs/cifsfs.h +++ b/fs/cifs/cifsfs.h @@ -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 *); diff --git a/fs/cifs/file.c b/fs/cifs/file.c index 1f720b2..37d61ce 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -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) {