Skip to contentSkip to conversation

NFS: Ensure nfs_wcc_update_inode always converts file size to loff_t

PATCH In review Chuck Lever 1 participant 1 message Oct 26, 2007

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 13/27 NFS: Ensure nfs_wcc_update_inode always converts file size to loff_t

The nfs_wcc_update_inode() function omits logic to convert the type of the NFS on-the-wire value of a file's size (__u64) to the type of file size value stored in struct inode (loff_t, which is signed).

Everywhere else in the NFS client I checked already correctly converts the file size type.

This effects only very large files.

---

 fs/nfs/inode.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
fs/nfs/inode.c +3 -2
index db5d96d..cd0e57f 100644
@@ -814,8 +814,9 @@ static void nfs_wcc_update_inode(struct inode *inode, struct nfs_fattr *fattr)
 			if (S_ISDIR(inode->i_mode))
 				nfsi->cache_validity |= NFS_INO_INVALID_DATA;
 		}
-		if (inode->i_size == fattr->pre_size && nfsi->npages == 0)
-			inode->i_size = fattr->size;
+		if (inode->i_size == nfs_size_to_loff_t(fattr->pre_size) &&
+		    nfsi->npages == 0)
+			inode->i_size = nfs_size_to_loff_t(fattr->size);
 	}
 }
 

-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs