From cel@citi.umich.edu Thu Dec 18 22:13:19 2003
Date: Thu, 18 Dec 2003 16:34:58 -0500 (EST)
From: Chuck Lever <cel@citi.umich.edu>
To: Marcelo Tosatti <marcelo@conectiva.com.br>
Cc: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
     Trond Myklebust <trond.myklebust@fys.uio.no>,
     Steve Dickson <SteveD@redhat.com>, greg.marsden@oracle.com
Subject: [PATCH] NFS O_DIRECT offset wrap bug

hi marcelo-

here's an obvious mistake i made in the NFS O_DIRECT implementation.  a
missing type cast causes the offset of direct read and write requests to
wrap at 4GB.  please include this in 2.4.24-pre2.

as far as i can tell, this is not a problem for 2.6 NFS O_DIRECT.


diff -X ../dont-diff -Naurp 00-stock/fs/nfs/direct.c 01-direct-offset/fs/nfs/direct.c
--- 00-stock/fs/nfs/direct.c	2003-08-25 07:44:43.000000000 -0400
+++ 01-direct-offset/fs/nfs/direct.c	2003-12-18 16:28:20.000000000 -0500
@@ -354,7 +354,7 @@ nfs_direct_IO(int rw, struct file *file,
 	size_t count = iobuf->length;
 	struct dentry *dentry = file->f_dentry;
 	struct inode *inode = dentry->d_inode;
-	loff_t offset = blocknr << inode->i_blkbits;
+	loff_t offset = (loff_t) blocknr << inode->i_blkbits;

 	switch (rw) {
 	case READ:

	- Chuck Lever
--
corporate:	<cel at netapp dot com>
personal:	<chucklever at bigfoot dot com>

-
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/
