提交 0d4c36a9 编写于 作者: K KAMEZAWA Hiroyuki 提交者: Linus Torvalds

/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: NKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Acked-by: NWANG Cong <xiyou.wangcong@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 678ad5d8
...@@ -546,6 +546,11 @@ static int open_kcore(struct inode *inode, struct file *filp) ...@@ -546,6 +546,11 @@ static int open_kcore(struct inode *inode, struct file *filp)
return -EPERM; return -EPERM;
if (kcore_need_update) if (kcore_need_update)
kcore_update_ram(); 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; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册