Re: NFS mountned directory and apache2 (2.5.47)

From: Trond Myklebust (trond.myklebust@fys.uio.no)
Date: Sun Nov 17 2002 - 15:18:04 EST


>>>>> " " == Christoph Hellwig <hch@infradead.org> writes:

> just a little bit more then one line :) nfs needs to do the
> same revalidation as in nfs_file_read and then call
> generic_file_sendfile.

Duh, I must have eaten a bad mushroom at dinner. Thanks for staying
awake...

The correct patch is of course as appended.

Cheers,
  Trond

--- linux-2.5.47/fs/nfs/file.c 2002-11-08 14:16:27.000000000 -0500
+++ linux-2.5.47-01-sendfile/fs/nfs/file.c 2002-11-17 15:15:04.000000000 -0500
@@ -35,6 +35,7 @@
 #define NFSDBG_FACILITY NFSDBG_FILE
 
 static int nfs_file_mmap(struct file *, struct vm_area_struct *);
+static ssize_t nfs_file_sendfile(struct file *, loff_t *, size_t, read_actor_t, void *);
 static ssize_t nfs_file_read(struct kiocb *, char *, size_t, loff_t);
 static ssize_t nfs_file_write(struct kiocb *, const char *, size_t, loff_t);
 static int nfs_file_flush(struct file *);
@@ -52,6 +53,7 @@
         .release = nfs_release,
         .fsync = nfs_fsync,
         .lock = nfs_lock,
+ .sendfile = nfs_file_sendfile,
 };
 
 struct inode_operations nfs_file_inode_operations = {
@@ -102,6 +104,24 @@
         return result;
 }
 
+static ssize_t
+nfs_file_sendfile(struct file *filp, loff_t *ppos, size_t count,
+ read_actor_t actor, void *target)
+{
+ struct dentry *dentry = filp->f_dentry;
+ struct inode *inode = dentry->d_inode;
+ ssize_t res;
+
+ dfprintk(VFS, "nfs: sendfile(%s/%s, %lu@%Lu)\n",
+ dentry->d_parent->d_name.name, dentry->d_name.name,
+ (unsigned long) count, (unsigned long long) *ppos);
+
+ res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
+ if (!res)
+ res = generic_file_sendfile(filp, ppos, count, actor, target);
+ return res;
+}
+
 static int
 nfs_file_mmap(struct file * file, struct vm_area_struct * vma)
 {
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Nov 23 2002 - 22:00:19 EST