Skip to content

Commit

Permalink
/proc/kcore: update stat.st_size after memory hotplug
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
KAMEZAWA Hiroyuki authored and Linus Torvalds committed Sep 23, 2009
1 parent 678ad5d commit 0d4c36a
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/proc/kcore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0d4c36a

Please sign in to comment.