summaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>2009-09-22 16:45:52 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2009-09-23 07:39:42 -0700
commit0d4c36a9b6ab6b15851f60956d901a3c53574ea8 (patch)
tree08ca4041ee0a3748835b34227868427b7a82467f /fs
parent678ad5d8aaf8925cb8465f84e1e47d9b1284666a (diff)
downloadop-kernel-dev-0d4c36a9b6ab6b15851f60956d901a3c53574ea8.zip
op-kernel-dev-0d4c36a9b6ab6b15851f60956d901a3c53574ea8.tar.gz
/proc/kcore: update stat.st_size after memory hotplug
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/proc/kcore.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/proc/kcore.c b/fs/proc/kcore.c
index 3d0485c..5601337 100644
--- a/fs/proc/kcore.c
+++ b/fs/proc/kcore.c
@@ -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;
}
OpenPOWER on IntegriCloud