coredump: move core_pipe_count to global variable

The pipe coredump counter is a static local variable instead of a global
variable like all of the rest. Move it to a global variable so it's all
consistent.

Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-12-315c0c34ba94@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2025-06-12 15:25:26 +02:00
parent a961c737cd
commit 4f599219f7
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2
1 changed files with 3 additions and 3 deletions

View File

@ -82,6 +82,7 @@ static unsigned int core_sort_vma;
static char core_pattern[CORENAME_MAX_SIZE] = "core";
static int core_name_size = CORENAME_MAX_SIZE;
unsigned int core_file_note_size_limit = CORE_FILE_NOTE_SIZE_DEFAULT;
static atomic_t core_pipe_count = ATOMIC_INIT(0);
enum coredump_type_t {
COREDUMP_FILE = 1,
@ -981,7 +982,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
size_t *argv = NULL;
int argc = 0;
bool core_dumped = false;
static atomic_t core_dump_count = ATOMIC_INIT(0);
struct coredump_params cprm = {
.siginfo = siginfo,
.limit = rlimit(RLIMIT_CORE),
@ -1057,7 +1057,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
}
cprm.limit = RLIM_INFINITY;
cn.core_pipe_limit = atomic_inc_return(&core_dump_count);
cn.core_pipe_limit = atomic_inc_return(&core_pipe_count);
if (core_pipe_limit && (core_pipe_limit < cn.core_pipe_limit)) {
coredump_report_failure("over core_pipe_limit, skipping core dump");
goto close_fail;
@ -1171,7 +1171,7 @@ close_fail:
filp_close(cprm.file, NULL);
if (cn.core_pipe_limit) {
VFS_WARN_ON_ONCE(cn.core_type != COREDUMP_PIPE);
atomic_dec(&core_dump_count);
atomic_dec(&core_pipe_count);
}
fail_unlock:
kfree(argv);