ftrace/scripts: Have recordmcount copy the object file
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>
Tue, 15 Dec 2015 21:06:10 +0000 (16:06 -0500)
committerZefan Li <lizefan@huawei.com>
Wed, 26 Oct 2016 15:15:39 +0000 (23:15 +0800)
commit334e907923e9cab057020a9c7ec7d9f32ead6573
tree062ede32682abe09bb2ff11bfa887a13d2170c76
parent38b8ae4f5e4e766b206950a978f9a9051d55318a
ftrace/scripts: Have recordmcount copy the object file

commit a50bd43935586420fb75f4558369eb08566fac5e upstream.

Russell King found that he had weird side effects when compiling the kernel
with hard linked ccache. The reason was that recordmcount modified the
kernel in place via mmap, and when a file gets modified twice by
recordmcount, it will complain about it. To fix this issue, Russell wrote a
patch that checked if the file was hard linked more than once and would
unlink it if it was.

Linus Torvalds was not happy with the fact that recordmcount does this in
place modification. Instead of doing the unlink only if the file has two or
more hard links, it does the unlink all the time. In otherwords, it always
does a copy if it changed something. That is, it does the write out if a
change was made.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Zefan Li <lizefan@huawei.com>
scripts/recordmcount.c