* Re: [LTP] [PATCH] statx08: Skip FS_COMPR_FL if it can't be set
[not found] <20261204093927.673808-1-hongli.li@intel.com>
@ 2026-12-04 14:59 ` Petr Vorel
0 siblings, 0 replies; only message in thread
From: Petr Vorel @ 2026-12-04 14:59 UTC (permalink / raw)
To: Hongli Li; +Cc: Konstantin Komarov, ltp, Zhenghao Niu
Hi all,
> stx_attributes_mask only tells that an attribute can be reported, not
> that it can be set with FS_IOC_SETFLAGS.
> Since commit 33f29fc7c67e ("fs/ntfs3: add fileattr support") in v7.2,
> ntfs3 reports STATX_ATTR_COMPRESSED in stx_attributes_mask, but its
> fileattr_set() rejects FS_COMPR_FL with EOPNOTSUPP:
> statx08.c:115: TBROK: ioctl(3, FS_IOC_SETFLAGS, 52): EOPNOTSUPP (95)
> This also stops the .all_filesystems loop before tmpfs is tested.
> On EOPNOTSUPP, drop FS_COMPR_FL and retry.
First, thanks for catching this!
> Tested-by: Zhenghao Niu <zhenghaox.niu@intel.com>
> Signed-off-by: Hongli Li <hongli.li@intel.com>
> ---
> testcases/kernel/syscalls/statx/statx08.c | 13 +++++++++++++
> 1 file changed, 13 insertions(+)
> diff --git a/testcases/kernel/syscalls/statx/statx08.c b/testcases/kernel/syscalls/statx/statx08.c
> index caced5d3d7..28fc2be148 100644
> --- a/testcases/kernel/syscalls/statx/statx08.c
> +++ b/testcases/kernel/syscalls/statx/statx08.c
> @@ -111,6 +111,19 @@ static void caid_flags_setup(void)
> attr |= FS_NODUMP_FL;
> ret = ioctl(fd, FS_IOC_SETFLAGS, &attr);
> +
> + /* e.g. ntfs3 reports FS_COMPR_FL but can't set it */
> + if (ret < 0 && errno == EOPNOTSUPP && supp_compr) {
> + tst_res(TCONF, "filesystem can't set FS_COMPR_FL");
> + supp_compr = 0;
> + attr &= ~FS_COMPR_FL;
> +
> + if (!(supp_append || supp_immutable || supp_nodump))
> + tst_brk(TCONF, "no other attr to test, skip it");
Wouldn't be better if the function return int and tst_brk was handled in
setup()? I'd prefer to have tst_brk(TCONF) on single place.
Kind regards,
Petr
> +
> + ret = ioctl(fd, FS_IOC_SETFLAGS, &attr);
> + }
> +
> if (ret < 0)
> tst_brk(TBROK | TERRNO, "ioctl(%i, FS_IOC_SETFLAGS, %i)", fd, attr);
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] only message in thread