Skip to content

Commit 4f59921

Browse files
committed
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>
1 parent a961c73 commit 4f59921

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

fs/coredump.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ static unsigned int core_sort_vma;
8282
static char core_pattern[CORENAME_MAX_SIZE] = "core";
8383
static int core_name_size = CORENAME_MAX_SIZE;
8484
unsigned int core_file_note_size_limit = CORE_FILE_NOTE_SIZE_DEFAULT;
85+
static atomic_t core_pipe_count = ATOMIC_INIT(0);
8586

8687
enum coredump_type_t {
8788
COREDUMP_FILE = 1,
@@ -981,7 +982,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
981982
size_t *argv = NULL;
982983
int argc = 0;
983984
bool core_dumped = false;
984-
static atomic_t core_dump_count = ATOMIC_INIT(0);
985985
struct coredump_params cprm = {
986986
.siginfo = siginfo,
987987
.limit = rlimit(RLIMIT_CORE),
@@ -1057,7 +1057,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
10571057
}
10581058
cprm.limit = RLIM_INFINITY;
10591059

1060-
cn.core_pipe_limit = atomic_inc_return(&core_dump_count);
1060+
cn.core_pipe_limit = atomic_inc_return(&core_pipe_count);
10611061
if (core_pipe_limit && (core_pipe_limit < cn.core_pipe_limit)) {
10621062
coredump_report_failure("over core_pipe_limit, skipping core dump");
10631063
goto close_fail;
@@ -1171,7 +1171,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
11711171
filp_close(cprm.file, NULL);
11721172
if (cn.core_pipe_limit) {
11731173
VFS_WARN_ON_ONCE(cn.core_type != COREDUMP_PIPE);
1174-
atomic_dec(&core_dump_count);
1174+
atomic_dec(&core_pipe_count);
11751175
}
11761176
fail_unlock:
11771177
kfree(argv);

0 commit comments

Comments
 (0)