]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
/proc/kcore: update stat.st_size after memory hotplug
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Tue, 22 Sep 2009 23:45:52 +0000 (16:45 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 23 Sep 2009 14:39:42 +0000 (07:39 -0700)
After memory hotplug (or other events in future), kcore size can be
modified.

To update inode->i_size, we have to know inode/dentry but we can't get it
from inside /proc directly.  But considerinyg memory hotplug, kcore image
is updated only when it's opened.  Then, updating inode->i_size at open()
is enough.

Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: WANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/proc/kcore.c

index 3d0485c361c73494ba87d81c1671ca03bd7820f0..56013371f9f3cdcd8c89a4455233522a415291aa 100644 (file)
@@ -546,6 +546,11 @@ static int open_kcore(struct inode *inode, struct file *filp)
                return -EPERM;
        if (kcore_need_update)
                kcore_update_ram();
+       if (i_size_read(inode) != proc_root_kcore->size) {
+               mutex_lock(&inode->i_mutex);
+               i_size_write(inode, proc_root_kcore->size);
+               mutex_unlock(&inode->i_mutex);
+       }
        return 0;
 }