[LTP] [PATCH v2 2/2] mount_setattr01: add open_tree_attr variant
Petr Vorel
pvorel@suse.cz
Wed Sep 17 14:22:28 CEST 2025
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;
> +}
More information about the ltp
mailing list