[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251028-work-coredump-signal-v1-20-ca449b7b7aa0@kernel.org>
Date: Tue, 28 Oct 2025 09:46:05 +0100
From: Christian Brauner <brauner@...nel.org>
To: linux-fsdevel@...r.kernel.org
Cc: Oleg Nesterov <oleg@...hat.com>, Amir Goldstein <amir73il@...il.com>,
Aleksa Sarai <cyphar@...har.com>,
Yu Watanabe <watanabe.yu+github@...il.com>,
Josef Bacik <josef@...icpanda.com>, Jeff Layton <jlayton@...nel.org>,
Jann Horn <jannh@...gle.com>, Luca Boccassi <luca.boccassi@...il.com>,
Alexander Mikhalitsyn <alexander@...alicyn.com>,
linux-kernel@...r.kernel.org, Alexander Viro <viro@...iv.linux.org.uk>,
Jan Kara <jack@...e.cz>, Lennart Poettering <lennart@...ttering.net>,
Mike Yuan <me@...dnzj.com>,
Zbigniew Jędrzejewski-Szmek <zbyszek@...waw.pl>,
Christian Brauner <brauner@...nel.org>
Subject: [PATCH 20/22] selftests/coredump: ignore ENOSPC errors
If we crash multiple processes at the same time we may run out of space.
Just ignore those errors. They're not actually all that relevant for the
test.
Signed-off-by: Christian Brauner <brauner@...nel.org>
---
tools/testing/selftests/coredump/coredump_socket_protocol_test.c | 4 ++++
tools/testing/selftests/coredump/coredump_socket_test.c | 5 +++--
tools/testing/selftests/coredump/coredump_test_helpers.c | 2 ++
3 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tools/testing/selftests/coredump/coredump_socket_protocol_test.c b/tools/testing/selftests/coredump/coredump_socket_protocol_test.c
index 566545e96d7f..d19b6717c53e 100644
--- a/tools/testing/selftests/coredump/coredump_socket_protocol_test.c
+++ b/tools/testing/selftests/coredump/coredump_socket_protocol_test.c
@@ -184,6 +184,8 @@ TEST_F(coredump, socket_request_kernel)
bytes_write = write(fd_core_file, buffer, bytes_read);
if (bytes_read != bytes_write) {
+ if (bytes_write < 0 && errno == ENOSPC)
+ continue;
fprintf(stderr, "socket_request_kernel: write to core file failed (read=%zd, write=%zd): %m\n",
bytes_read, bytes_write);
goto out;
@@ -1366,6 +1368,8 @@ TEST_F_TIMEOUT(coredump, socket_multiple_crashing_coredumps, 500)
bytes_write = write(fd_core_file, buffer, bytes_read);
if (bytes_read != bytes_write) {
+ if (bytes_write < 0 && errno == ENOSPC)
+ continue;
fprintf(stderr, "write failed for fd %d: %m\n", fd_core_file);
goto out;
}
diff --git a/tools/testing/selftests/coredump/coredump_socket_test.c b/tools/testing/selftests/coredump/coredump_socket_test.c
index 0a37d0456672..da558a0e37aa 100644
--- a/tools/testing/selftests/coredump/coredump_socket_test.c
+++ b/tools/testing/selftests/coredump/coredump_socket_test.c
@@ -158,8 +158,9 @@ TEST_F(coredump, socket)
bytes_write = write(fd_core_file, buffer, bytes_read);
if (bytes_read != bytes_write) {
- fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n",
- bytes_read, bytes_write);
+ if (bytes_write < 0 && errno == ENOSPC)
+ continue;
+ fprintf(stderr, "socket test: write to core file failed (read=%zd, write=%zd): %m\n", bytes_read, bytes_write);
goto out;
}
}
diff --git a/tools/testing/selftests/coredump/coredump_test_helpers.c b/tools/testing/selftests/coredump/coredump_test_helpers.c
index 65deb3cfbe1b..a6f6d5f2ae07 100644
--- a/tools/testing/selftests/coredump/coredump_test_helpers.c
+++ b/tools/testing/selftests/coredump/coredump_test_helpers.c
@@ -357,6 +357,8 @@ void process_coredump_worker(int fd_coredump, int fd_peer_pidfd, int fd_core_fil
goto done;
ssize_t bytes_write = write(fd_core_file, buffer, bytes_read);
if (bytes_write != bytes_read) {
+ if (bytes_write < 0 && errno == ENOSPC)
+ continue;
fprintf(stderr, "Worker: write() failed (read=%zd, write=%zd): %m\n",
bytes_read, bytes_write);
goto out;
--
2.47.3
Powered by blists - more mailing lists