public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: Andrea Cervesato <andrea.cervesato@suse.de>
Cc: ltp@lists.linux.it
Subject: Re: [LTP] [PATCH v2 2/2] mount_setattr01: add open_tree_attr variant
Date: Wed, 17 Sep 2025 14:22:28 +0200	[thread overview]
Message-ID: <20250917122228.GB343943@pevik> (raw)
In-Reply-To: <20250902-open_tree_attr-v2-2-b23d2585986d@suse.com>

Hi Andrea,

generally LGTM. But it'd be great (can be a separate effort) if you could write
checkers similar to fsopen_supported_by_kernel() for __NR_mount_setattr and
__NR_open_tree_attr. That would save time wasted when looping filesystem on the
variants which aren't supported.

Also while at it, could you fix older typo: 'sucess' => 'success' ?

Reviewed-by: Petr Vorel <pvorel@suse.cz>

...
>  static struct tcase {
>  	char *name;
> @@ -66,35 +69,61 @@ static void cleanup(void)
>  static void setup(void)
>  {
>  	fsopen_supported_by_kernel();
> -	struct stat st = {0};

> -	if (stat(OT_MNTPOINT, &st) == -1)
> +	if (access(OT_MNTPOINT, F_OK) != 0)
Out of curiosity why this change? Faster?

>  		SAFE_MKDIR(OT_MNTPOINT, 0777);
>  }

> +static int open_tree_variant1(struct mount_attr *attr)
> +{
> +	tst_res(TINFO, "Variant using open_tree() + mount_setattr()");
nit: I'm not an english speaker, but I would say "Using variant ..."

> +
> +	otfd = TST_EXP_FD_SILENT(open_tree(AT_FDCWD, MNTPOINT,
> +			AT_EMPTY_PATH | OPEN_TREE_CLONE));
> +	if (otfd == -1)
> +		return -1;
> +
> +	TST_EXP_PASS(mount_setattr(otfd, "", AT_EMPTY_PATH,
> +			attr, sizeof(*attr)));
> +	if (TST_RET == -1) {
> +		SAFE_CLOSE(otfd);
> +		return -1;
> +	}
> +
> +	return otfd;
> +}
> +
> +static int open_tree_variant2(struct mount_attr *attr)
> +{
> +	tst_res(TINFO, "Variant using open_tree_attr()");
And here.

The rest LGTM.

Kind regards,
Petr
> +
> +	otfd = TST_EXP_FD(open_tree_attr(AT_FDCWD, MNTPOINT,
> +			AT_EMPTY_PATH | OPEN_TREE_CLONE,
> +			attr, sizeof(*attr)));
> +
> +	return otfd;
> +}

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

  reply	other threads:[~2025-09-17 12:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-09-02  8:29 [LTP] [PATCH v2 0/2] open_tree_attr syscall coverage Andrea Cervesato
2025-09-02  8:29 ` [LTP] [PATCH v2 1/2] Add open_tree_attr fallback Andrea Cervesato
2025-09-17 12:02   ` Petr Vorel
2025-09-02  8:29 ` [LTP] [PATCH v2 2/2] mount_setattr01: add open_tree_attr variant Andrea Cervesato
2025-09-17 12:22   ` Petr Vorel [this message]
2025-09-17 12:41     ` Andrea Cervesato via ltp

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=20250917122228.GB343943@pevik \
    --to=pvorel@suse.cz \
    --cc=andrea.cervesato@suse.de \
    --cc=ltp@lists.linux.it \
    /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