diff -urN linux-2.6.38.2-orig/fs/proc/base.c linux-2.6.38.2/fs/proc/base.c --- linux-2.6.38.2-orig/fs/proc/base.c 2011-03-28 03:37:20 +0900 +++ linux-2.6.38.2/fs/proc/base.c 2011-04-10 22:22:18 +0900 @@ -1757,7 +1757,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 @@ -1947,6 +1947,7 @@ struct task_struct *task; int fd; struct files_struct *files; + struct file *file; const struct cred *cred; if (nd && nd->flags & LOOKUP_RCU) @@ -1960,7 +1961,9 @@ 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)) { @@ -2029,7 +2032,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; d_set_d_op(dentry, &tid_fd_dentry_operations); d_add(dentry, inode);