Commit 6409324b385f3f63a03645b4422e3be67348d922
Committed by
Linus Torvalds
1 parent
b747c8c102
Exists in
master
and in
7 other branches
coredump: format_corename: don't append .%pid if multi-threaded
If the coredumping is multi-threaded, format_corename() appends .%pid to the corename. This was needed before the proper multi-thread core dump support, now all the threads in the mm go into a single unified core file. Remove this special case, it is not even documented and we have "%p" and core_uses_pid. Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru> Cc: Michael Kerrisk <mtk.manpages@googlemail.com> Cc: Oleg Nesterov <oleg@tv-sign.ru> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Roland McGrath <roland@redhat.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: La Monte Yarroll <piggy@laurelnetworks.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 1 changed file with 3 additions and 4 deletions Side-by-side Diff
fs/exec.c
... | ... | @@ -1386,7 +1386,7 @@ |
1386 | 1386 | * name into corename, which must have space for at least |
1387 | 1387 | * CORENAME_MAX_SIZE bytes plus one byte for the zero terminator. |
1388 | 1388 | */ |
1389 | -static int format_corename(char *corename, int nr_threads, long signr) | |
1389 | +static int format_corename(char *corename, long signr) | |
1390 | 1390 | { |
1391 | 1391 | const char *pat_ptr = core_pattern; |
1392 | 1392 | int ispipe = (*pat_ptr == '|'); |
... | ... | @@ -1493,8 +1493,7 @@ |
1493 | 1493 | * If core_pattern does not include a %p (as is the default) |
1494 | 1494 | * and core_uses_pid is set, then .%pid will be appended to |
1495 | 1495 | * the filename. Do not do this for piped commands. */ |
1496 | - if (!ispipe && !pid_in_pattern | |
1497 | - && (core_uses_pid || nr_threads)) { | |
1496 | + if (!ispipe && !pid_in_pattern && core_uses_pid) { | |
1498 | 1497 | rc = snprintf(out_ptr, out_end - out_ptr, |
1499 | 1498 | ".%d", task_tgid_vnr(current)); |
1500 | 1499 | if (rc > out_end - out_ptr) |
... | ... | @@ -1757,7 +1756,7 @@ |
1757 | 1756 | * uses lock_kernel() |
1758 | 1757 | */ |
1759 | 1758 | lock_kernel(); |
1760 | - ispipe = format_corename(corename, retval, signr); | |
1759 | + ispipe = format_corename(corename, signr); | |
1761 | 1760 | unlock_kernel(); |
1762 | 1761 | /* |
1763 | 1762 | * Don't bother to check the RLIMIT_CORE value if core_pattern points |