diff -urN linux-2.6.31-orig/fs/proc/base.c linux-2.6.31/fs/proc/base.c --- linux-2.6.31-orig/fs/proc/base.c 2009-09-10 07:13:59 +0900 +++ linux-2.6.31/fs/proc/base.c 2009-11-10 00:16:51 +0900 @@ -1483,7 +1483,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. * * Before the /proc/pid/status file was created the only way to read * the effective uid of a /process was to stat /proc/pid. Reading @@ -1667,13 +1667,16 @@ struct task_struct *task = get_proc_task(inode); int fd = proc_fd(inode); struct files_struct *files; + struct file *file; const struct cred *cred; if (task) { files = get_files_struct(task); if (files) { rcu_read_lock(); - if (fcheck_files(files, fd)) { + file = fcheck_files(files, fd); + if (file) { + inode->i_size = file->f_pos; rcu_read_unlock(); put_files_struct(files); if (task_dumpable(task)) { @@ -1742,7 +1745,7 @@ 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);