From: Cyril Hrubis <chrubis@suse.cz>
To: Petr Vorel <pvorel@suse.cz>
Cc: Stephen Bertram <sbertram@redhat.com>, ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2] accept03/tst_fd: Harden parallel runs against
Date: Thu, 5 Nov 2026 11:33:51 +0100 [thread overview]
Message-ID: <auxbj8043hAPYz-A@yuki.lan> (raw)
In-Reply-To: <20261104183259.423259-1-pvorel@suse.cz>
Hi!
> commit fa68043e5948ff1b8cb2c647d309ccf4808e23d7
> Author: Petr Vorel <pvorel@suse.cz>
> Date: 2026-11-04 18:34:06 +0100
>
> tst_fd: Add check for missing .needs_tmpdir
>
> Signed-off-by: Petr Vorel <pvorel@suse.cz>
>
> diff --git lib/tst_fd.c lib/tst_fd.c
> index 6538a098c7..05e1bbe8b0 100644
> --- lib/tst_fd.c
> +++ lib/tst_fd.c
> @@ -22,6 +22,8 @@
> #include "lapi/bpf.h"
> #include "lapi/fsmount.h"
>
> +#include "tso_tmpdir.h"
> +
> #include "tst_fd.h"
>
> struct tst_fd_desc {
> @@ -30,8 +32,17 @@ struct tst_fd_desc {
> const char *desc;
> };
>
> +static void require_tmpdir(struct tst_fd *fd)
> +{
> + if (!tst_tmpdir_created()) {
> + tst_brk(TBROK, "%s fd requires .needs_tmpdir = 1",
> + tst_fd_desc(fd));
> + }
> +}
> +
> static void open_file(struct tst_fd *fd)
> {
> + require_tmpdir(fd);
> fd->fd = SAFE_OPEN("fd_file", O_RDWR | O_CREAT, 0666);
> SAFE_UNLINK("fd_file");
> }
> @@ -40,6 +51,7 @@ static void open_path(struct tst_fd *fd)
> {
> int tfd;
>
> + require_tmpdir(fd);
> tfd = SAFE_CREAT("fd_file", 0666);
> SAFE_CLOSE(tfd);
>
> @@ -50,6 +62,7 @@ static void open_path(struct tst_fd *fd)
>
> static void open_dir(struct tst_fd *fd)
> {
> + require_tmpdir(fd);
> SAFE_MKDIR("fd_dir", 0700);
> fd->fd = SAFE_OPEN("fd_dir", O_DIRECTORY);
> SAFE_RMDIR("fd_dir");
This approach looks good to me.
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
next prev parent reply other threads:[~2026-11-05 10:33 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-04 14:46 [LTP] [PATCH v1] accept03/tst_fd: Harden parallel runs against shared path races Stephen Bertram via ltp
2026-11-04 15:14 ` Cyril Hrubis
2026-11-04 16:46 ` [LTP] [PATCH v2] " Stephen Bertram via ltp
2026-11-04 18:32 ` [LTP] [PATCH v2] accept03/tst_fd: Harden parallel runs against Petr Vorel
2026-11-05 10:33 ` Cyril Hrubis [this message]
2026-11-04 19:00 ` [LTP] accept03/tst_fd: Harden parallel runs against shared path races linuxtestproject.agent
2026-11-04 20:35 ` [LTP] [PATCH v3] " Stephen Bertram via ltp
2026-11-05 0:38 ` [LTP] " linuxtestproject.agent
2026-11-06 12:19 ` [LTP] [PATCH v3] " Cyril Hrubis
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=auxbj8043hAPYz-A@yuki.lan \
--to=chrubis@suse.cz \
--cc=ltp@lists.linux.it \
--cc=pvorel@suse.cz \
--cc=sbertram@redhat.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.