From: Xing Guo <higuoxing@gmail.com>
To: andrii.nakryiko@gmail.com
Cc: alexei.starovoitov@gmail.com, andrii@kernel.org, ast@kernel.org,
bpf@vger.kernel.org, higuoxing@gmail.com,
linux-kselftest@vger.kernel.org, olsajiri@gmail.com,
sveiss@meta.com
Subject: [PATCH bpf v5] selftests: arg_parsing: Ensure data is flushed to disk before reading.
Date: Thu, 16 Oct 2025 11:19:23 +0800 [thread overview]
Message-ID: <20251016031923.3169221-1-higuoxing@gmail.com> (raw)
In-Reply-To: <CAEf4BzaSPbsWGw9XiFq7qt7P0m0Yoquuxca39QrvorKFeS+LAg@mail.gmail.com>
test_parse_test_list_file writes some data to
/tmp/bpf_arg_parsing_test.XXXXXX and parse_test_list_file() will read
the data back. However, after writing data to that file, we forget to
call fsync() and it's causing testing failure in my laptop. This patch
helps fix it by adding the missing fsync() call.
Signed-off-by: Xing Guo <higuoxing@gmail.com>
---
tools/testing/selftests/bpf/prog_tests/arg_parsing.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/tools/testing/selftests/bpf/prog_tests/arg_parsing.c b/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
index fbf0d9c2f58b..e27d66b75fb1 100644
--- a/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
+++ b/tools/testing/selftests/bpf/prog_tests/arg_parsing.c
@@ -144,6 +144,9 @@ static void test_parse_test_list_file(void)
if (!ASSERT_OK(ferror(fp), "prepare tmp"))
goto out_fclose;
+ if (!ASSERT_OK(fsync(fileno(fp)), "fsync tmp"))
+ goto out_fclose;
+
init_test_filter_set(&set);
if (!ASSERT_OK(parse_test_list_file(tmpfile, &set, true), "parse file"))
--
2.51.0
next prev parent reply other threads:[~2025-10-16 3:19 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-14 8:03 [PATCH] selftests: arg_parsing: Ensure data is flushed to disk before reading Xing Guo
2025-10-14 12:39 ` Jiri Olsa
2025-10-14 20:53 ` Andrii Nakryiko
2025-10-15 2:43 ` [PATCH v2] " Xing Guo
2025-10-15 2:45 ` Alexei Starovoitov
2025-10-15 2:50 ` Xing Guo
2025-10-15 16:10 ` patchwork-bot+netdevbpf
2025-10-15 16:20 ` Andrii Nakryiko
2025-10-16 2:28 ` [PATCH v3] " Xing Guo
2025-10-16 2:32 ` [PATCH v2] " Xing Guo
2025-10-16 2:37 ` [PATCH bpf v4] " Xing Guo
2025-10-16 3:19 ` Xing Guo [this message]
2025-10-16 3:53 ` [PATCH bpf v6] " Xing Guo
2025-10-16 16:36 ` Andrii Nakryiko
2025-10-20 8:59 ` strace log before the fix, with fsync fix and with fclose fix Xing Guo
2025-10-20 16:28 ` Alexei Starovoitov
2025-10-20 20:12 ` Andrii Nakryiko
2025-10-21 22:14 ` Dominique Martinet
2025-10-16 16:40 ` [PATCH bpf v6] selftests: arg_parsing: Ensure data is flushed to disk before reading patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251016031923.3169221-1-higuoxing@gmail.com \
--to=higuoxing@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=olsajiri@gmail.com \
--cc=sveiss@meta.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox