* [LTP] [PATCH v3] syscalls: add file_attr05 test
@ 2026-01-20 10:51 Andrea Cervesato
2026-01-20 12:43 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Andrea Cervesato @ 2026-01-20 10:51 UTC (permalink / raw)
To: Linux Test Project
From: Andrea Cervesato <andrea.cervesato@suse.com>
Verify that `file_setattr` is correctly raising EOPNOTSUPP when
filesystem doesn't support FSX operations.
Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set]
return -EOPNOTSUPP".
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
runtest/syscalls | 1 +
testcases/kernel/syscalls/file_attr/.gitignore | 1 +
testcases/kernel/syscalls/file_attr/file_attr05.c | 63 +++++++++++++++++++++++
3 files changed, 65 insertions(+)
diff --git a/runtest/syscalls b/runtest/syscalls
index a1ef7548b58a1a8d51d8eec347d5772edbf0a953..12b4f3949c794b8747ccc827a1a66b6332e44673 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -253,6 +253,7 @@ file_attr01 file_attr01
file_attr02 file_attr02
file_attr03 file_attr03
file_attr04 file_attr04
+file_attr05 file_attr05
#posix_fadvise test cases
posix_fadvise01 posix_fadvise01
diff --git a/testcases/kernel/syscalls/file_attr/.gitignore b/testcases/kernel/syscalls/file_attr/.gitignore
index 3fcb9004dd301ef4ee8cc1067c6a3763acb8d299..42f830a7e477cf42a967f5b14b7e4b6902c4f0e3 100644
--- a/testcases/kernel/syscalls/file_attr/.gitignore
+++ b/testcases/kernel/syscalls/file_attr/.gitignore
@@ -2,3 +2,4 @@ file_attr01
file_attr02
file_attr03
file_attr04
+file_attr05
diff --git a/testcases/kernel/syscalls/file_attr/file_attr05.c b/testcases/kernel/syscalls/file_attr/file_attr05.c
new file mode 100644
index 0000000000000000000000000000000000000000..44d803ed8731a339ceeda18d1fffcfd775061c05
--- /dev/null
+++ b/testcases/kernel/syscalls/file_attr/file_attr05.c
@@ -0,0 +1,63 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2025 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * Verify that `file_setattr` is correctly raising EOPNOTSUPP when filesystem
+ * doesn't support FSX operations.
+ *
+ * Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set] return
+ * -EOPNOTSUPP".
+ */
+
+#include "tst_test.h"
+#include "lapi/fs.h"
+
+#define MNTPOINT "mntpoint"
+#define FILEPATH (MNTPOINT "/ltp_file")
+#define BLOCKS 128
+#define PROJID 16
+
+static struct file_attr *attr_set;
+
+static void run(void)
+{
+ TST_EXP_FAIL(file_setattr(AT_FDCWD, FILEPATH,
+ attr_set, FILE_ATTR_SIZE_LATEST, 0), EOPNOTSUPP);
+}
+
+static void setup(void)
+{
+ struct stat statbuf;
+
+ SAFE_TOUCH(FILEPATH, 0777, NULL);
+
+ SAFE_STAT(MNTPOINT, &statbuf);
+
+ attr_set->fa_xflags |= FS_XFLAG_EXTSIZE;
+ attr_set->fa_xflags |= FS_XFLAG_COWEXTSIZE;
+ attr_set->fa_extsize = BLOCKS * statbuf.st_blksize;
+ attr_set->fa_cowextsize = BLOCKS * statbuf.st_blksize;
+ attr_set->fa_projid = PROJID;
+}
+
+static struct tst_test test = {
+ .test_all = run,
+ .setup = setup,
+ .mntpoint = MNTPOINT,
+ .needs_root = 1,
+ .mount_device = 1,
+ .all_filesystems = 1,
+ .format_device = 1,
+ .skip_filesystems = (const char *const []) {
+ "xfs",
+ "fuse", /* EINVAL is raised before EOPNOTSUPP */
+ "vfat", /* vfat is not implementing file_[set|get]attr */
+ NULL,
+ },
+ .bufs = (struct tst_buffers []) {
+ {&attr_set, .size = sizeof(struct file_attr)},
+ {}
+ }
+};
---
base-commit: 36b915cef08adaa833af79301780cdd45a38f0e2
change-id: 20260119-file_attr05-eebcc81b9d46
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH v3] syscalls: add file_attr05 test
2026-01-20 10:51 [LTP] [PATCH v3] syscalls: add file_attr05 test Andrea Cervesato
@ 2026-01-20 12:43 ` Petr Vorel
2026-01-20 13:22 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2026-01-20 12:43 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: Linux Test Project
Hi Andrea,
> From: Andrea Cervesato <andrea.cervesato@suse.com>
> Verify that `file_setattr` is correctly raising EOPNOTSUPP when
> filesystem doesn't support FSX operations.
> Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set]
> return -EOPNOTSUPP".
Reason for changing approach in v3:
https://lore.kernel.org/ltp/DFTCS1EEBMDD.21X779ISM0MTF@suse.com/
> +++ b/testcases/kernel/syscalls/file_attr/file_attr05.c
> @@ -0,0 +1,63 @@
> +// SPDX-License-Identifier: GPL-2.0-or-later
> +/*
> + * Copyright (C) 2025 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> + */
> +
> +/*\
> + * Verify that `file_setattr` is correctly raising EOPNOTSUPP when filesystem
> + * doesn't support FSX operations.
> + *
> + * Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set] return
> + * -EOPNOTSUPP".
Why not added into .tags?
nit: Also the usual way of referring commits is:
474b155adf392 ("fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP")
> + */
> +
> +#include "tst_test.h"
> +#include "lapi/fs.h"
> +
> +#define MNTPOINT "mntpoint"
> +#define FILEPATH (MNTPOINT "/ltp_file")
> +#define BLOCKS 128
> +#define PROJID 16
> +
> +static struct file_attr *attr_set;
> +
> +static void run(void)
> +{
> + TST_EXP_FAIL(file_setattr(AT_FDCWD, FILEPATH,
> + attr_set, FILE_ATTR_SIZE_LATEST, 0), EOPNOTSUPP);
> +}
> +
> +static void setup(void)
> +{
> + struct stat statbuf;
> +
> + SAFE_TOUCH(FILEPATH, 0777, NULL);
> +
> + SAFE_STAT(MNTPOINT, &statbuf);
> +
> + attr_set->fa_xflags |= FS_XFLAG_EXTSIZE;
> + attr_set->fa_xflags |= FS_XFLAG_COWEXTSIZE;
> + attr_set->fa_extsize = BLOCKS * statbuf.st_blksize;
> + attr_set->fa_cowextsize = BLOCKS * statbuf.st_blksize;
> + attr_set->fa_projid = PROJID;
> +}
> +
> +static struct tst_test test = {
> + .test_all = run,
> + .setup = setup,
> + .mntpoint = MNTPOINT,
> + .needs_root = 1,
> + .mount_device = 1,
> + .all_filesystems = 1,
> + .format_device = 1,
> + .skip_filesystems = (const char *const []) {
> + "xfs",
> + "fuse", /* EINVAL is raised before EOPNOTSUPP */
> + "vfat", /* vfat is not implementing file_[set|get]attr */
Hm, funny, vfat not implementing also raises EOPNOTSUPP. I wonder if we should
keep it as well.
> + NULL,
> + },
> + .bufs = (struct tst_buffers []) {
> + {&attr_set, .size = sizeof(struct file_attr)},
Again, I'd put 474b155adf392 into tags. It's IMHO enough (no need for mentioning
it in the docs.
Kind regards,
Petr
> + {}
> + }
> +};
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [LTP] [PATCH v3] syscalls: add file_attr05 test
2026-01-20 12:43 ` Petr Vorel
@ 2026-01-20 13:22 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 3+ messages in thread
From: Andrea Cervesato via ltp @ 2026-01-20 13:22 UTC (permalink / raw)
To: Petr Vorel, Andrea Cervesato; +Cc: Linux Test Project
On Tue Jan 20, 2026 at 1:43 PM CET, Petr Vorel wrote:
> Hi Andrea,
>
> > From: Andrea Cervesato <andrea.cervesato@suse.com>
>
> > Verify that `file_setattr` is correctly raising EOPNOTSUPP when
> > filesystem doesn't support FSX operations.
>
> > Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set]
> > return -EOPNOTSUPP".
>
> Reason for changing approach in v3:
> https://lore.kernel.org/ltp/DFTCS1EEBMDD.21X779ISM0MTF@suse.com/
>
> > +++ b/testcases/kernel/syscalls/file_attr/file_attr05.c
> > @@ -0,0 +1,63 @@
> > +// SPDX-License-Identifier: GPL-2.0-or-later
> > +/*
> > + * Copyright (C) 2025 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
> > + */
> > +
> > +/*\
> > + * Verify that `file_setattr` is correctly raising EOPNOTSUPP when filesystem
> > + * doesn't support FSX operations.
> > + *
> > + * Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set] return
> > + * -EOPNOTSUPP".
> Why not added into .tags?
> nit: Also the usual way of referring commits is:
> 474b155adf392 ("fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP")
>
> > + */
> > +
> > +#include "tst_test.h"
> > +#include "lapi/fs.h"
> > +
> > +#define MNTPOINT "mntpoint"
> > +#define FILEPATH (MNTPOINT "/ltp_file")
> > +#define BLOCKS 128
> > +#define PROJID 16
> > +
> > +static struct file_attr *attr_set;
> > +
> > +static void run(void)
> > +{
> > + TST_EXP_FAIL(file_setattr(AT_FDCWD, FILEPATH,
> > + attr_set, FILE_ATTR_SIZE_LATEST, 0), EOPNOTSUPP);
> > +}
> > +
> > +static void setup(void)
> > +{
> > + struct stat statbuf;
> > +
> > + SAFE_TOUCH(FILEPATH, 0777, NULL);
> > +
> > + SAFE_STAT(MNTPOINT, &statbuf);
> > +
> > + attr_set->fa_xflags |= FS_XFLAG_EXTSIZE;
> > + attr_set->fa_xflags |= FS_XFLAG_COWEXTSIZE;
> > + attr_set->fa_extsize = BLOCKS * statbuf.st_blksize;
> > + attr_set->fa_cowextsize = BLOCKS * statbuf.st_blksize;
> > + attr_set->fa_projid = PROJID;
> > +}
> > +
> > +static struct tst_test test = {
> > + .test_all = run,
> > + .setup = setup,
> > + .mntpoint = MNTPOINT,
> > + .needs_root = 1,
> > + .mount_device = 1,
> > + .all_filesystems = 1,
> > + .format_device = 1,
> > + .skip_filesystems = (const char *const []) {
> > + "xfs",
> > + "fuse", /* EINVAL is raised before EOPNOTSUPP */
> > + "vfat", /* vfat is not implementing file_[set|get]attr */
>
> Hm, funny, vfat not implementing also raises EOPNOTSUPP. I wonder if we should
> keep it as well.
It makes sense from the point of view of the results, but it doesn't
make sense from the point of view of the test's meaning. EOPNOTSUPP in
case of vfat is raised for other reasons.
>
> > + NULL,
> > + },
> > + .bufs = (struct tst_buffers []) {
> > + {&attr_set, .size = sizeof(struct file_attr)},
> Again, I'd put 474b155adf392 into tags. It's IMHO enough (no need for mentioning
> it in the docs.
Sorry I forgot, I'm going to send a v4.
--
Andrea Cervesato
SUSE QE Automation Engineer Linux
andrea.cervesato@suse.com
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-20 13:23 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-20 10:51 [LTP] [PATCH v3] syscalls: add file_attr05 test Andrea Cervesato
2026-01-20 12:43 ` Petr Vorel
2026-01-20 13:22 ` Andrea Cervesato via ltp
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox