--- ../linux-2.6.13-orig/fs/proc/base.c	2005-08-29 08:41:01 +0900
+++ fs/proc/base.c	2005-09-01 11:22:52 +0900
@@ -1170,7 +1170,7 @@
  * due to the way we treat inodes.
  *
  * Rewrite the inode's ownerships here because the owning task may have
- * performed a setuid(), etc.
+ * performed a setuid(), etc.  Also update file position for FD entries.
  */
 static int pid_revalidate(struct dentry *dentry, struct nameidata *nd)
 {
@@ -1197,11 +1197,13 @@
 	struct task_struct *task = proc_task(inode);
 	int fd = proc_type(inode) - PROC_TID_FD_DIR;
 	struct files_struct *files;
+	struct file * file;
 
 	files = get_files_struct(task);
 	if (files) {
 		spin_lock(&files->file_lock);
-		if (fcheck_files(files, fd)) {
+		file = fcheck_files(files, fd);
+		if (file) {
 			spin_unlock(&files->file_lock);
 			put_files_struct(files);
 			if (task_dumpable(task)) {
@@ -1211,6 +1213,7 @@
 				inode->i_uid = 0;
 				inode->i_gid = 0;
 			}
+			inode->i_size = file->f_pos;
 			security_task_to_inode(task, inode);
 			return 1;
 		}
@@ -1317,7 +1320,7 @@
 	spin_unlock(&files->file_lock);
 	put_files_struct(files);
 	inode->i_op = &proc_pid_link_inode_operations;
-	inode->i_size = 64;
+	inode->i_size = file->f_pos;
 	ei->op.proc_get_link = proc_fd_link;
 	dentry->d_op = &tid_fd_dentry_operations;
 	d_add(dentry, inode);
