* [LTP] [PATCH v2] syscalls: add file_attr05 test
@ 2025-10-14 7:58 Andrea Cervesato
2026-01-16 11:20 ` Li Wang via ltp
2026-01-19 12:39 ` Cyril Hrubis
0 siblings, 2 replies; 7+ messages in thread
From: Andrea Cervesato @ 2025-10-14 7:58 UTC (permalink / raw)
To: ltp
From: Andrea Cervesato <andrea.cervesato@suse.com>
Verify that `file_getattr` and `file_setattr` are correctly raising
EOPNOTSUPP when filesystem doesn't support them.
Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set]
return -EOPNOTSUPP".
Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
---
Changes in v2:
- use f4af1fb44161d719695c3ce1bcad61d6f3638ba8 as reference for block
size
- Link to v1: https://lore.kernel.org/r/20251010-file_attr_eopnotsupp-v1-1-a93df1980ac7@suse.com
---
runtest/syscalls | 1 +
testcases/kernel/syscalls/file_attr/.gitignore | 1 +
testcases/kernel/syscalls/file_attr/file_attr05.c | 64 +++++++++++++++++++++++
3 files changed, 66 insertions(+)
diff --git a/runtest/syscalls b/runtest/syscalls
index 4b284f279..b8a1988e1 100644
--- a/runtest/syscalls
+++ b/runtest/syscalls
@@ -250,6 +250,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 3fcb9004d..42f830a7e 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 000000000..087d269a4
--- /dev/null
+++ b/testcases/kernel/syscalls/file_attr/file_attr05.c
@@ -0,0 +1,64 @@
+// SPDX-License-Identifier: GPL-2.0-or-later
+/*
+ * Copyright (C) 2025 SUSE LLC Andrea Cervesato <andrea.cervesato@suse.com>
+ */
+
+/*\
+ * Verify that `file_getattr` and `file_setattr` are correctly raising
+ * EOPNOTSUPP when filesystem doesn't support them.
+ *
+ * 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 struct file_attr *attr_get;
+
+static void run(void)
+{
+ TST_EXP_FAIL(file_setattr(AT_FDCWD, FILEPATH,
+ attr_set, FILE_ATTR_SIZE_LATEST, 0), EOPNOTSUPP);
+
+ TST_EXP_FAIL(file_getattr(AT_FDCWD, FILEPATH,
+ attr_get, 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,
+ .filesystems = (struct tst_fs []) {
+ {.type = "vfat"},
+ {}
+ },
+ .bufs = (struct tst_buffers []) {
+ {&attr_set, .size = sizeof(struct file_attr)},
+ {&attr_get, .size = sizeof(struct file_attr)},
+ {}
+ }
+};
---
base-commit: cc420865c291c04c902957a6f3375c8017239e52
change-id: 20251010-file_attr_eopnotsupp-586cfb2c78d8
Best regards,
--
Andrea Cervesato <andrea.cervesato@suse.com>
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2025-10-14 7:58 [LTP] [PATCH v2] syscalls: add file_attr05 test Andrea Cervesato
@ 2026-01-16 11:20 ` Li Wang via ltp
2026-01-19 12:39 ` Cyril Hrubis
1 sibling, 0 replies; 7+ messages in thread
From: Li Wang via ltp @ 2026-01-16 11:20 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Reviewed-by: Li Wang <liwang@redhat.com>
--
Regards,
Li Wang
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2025-10-14 7:58 [LTP] [PATCH v2] syscalls: add file_attr05 test Andrea Cervesato
2026-01-16 11:20 ` Li Wang via ltp
@ 2026-01-19 12:39 ` Cyril Hrubis
2026-01-19 14:03 ` Andrea Cervesato via ltp
1 sibling, 1 reply; 7+ messages in thread
From: Cyril Hrubis @ 2026-01-19 12:39 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi!
> + .filesystems = (struct tst_fs []) {
> + {.type = "vfat"},
I wonder if we can add more filesystems here, just to make sure that we
run the test even when vfat is not compiled in the kernel. Does ext2
implement the file_set/getattr calls?
> + {}
> + },
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2026-01-19 12:39 ` Cyril Hrubis
@ 2026-01-19 14:03 ` Andrea Cervesato via ltp
2026-01-20 9:59 ` Petr Vorel
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Cervesato via ltp @ 2026-01-19 14:03 UTC (permalink / raw)
To: Cyril Hrubis, Andrea Cervesato; +Cc: ltp
Hi!
On Mon Jan 19, 2026 at 1:39 PM CET, Cyril Hrubis wrote:
> Hi!
> > + .filesystems = (struct tst_fs []) {
> > + {.type = "vfat"},
>
> I wonder if we can add more filesystems here, just to make sure that we
> run the test even when vfat is not compiled in the kernel. Does ext2
> implement the file_set/getattr calls?
>
> > + {}
> > + },
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
vfat and ntfs are the only ones which don't support both file_setattr()
and file_getattr(), while ext family, tmpfs and btrfs don't raise
EOPNOTSUPP for file_getattr() only. I'm wondering if that's a bug, since
xfs is our reference for this implementation, or this has been
introduced in 6.18-rc2 by 7ea30958b3054f5e488fa0b33c352723f7ab3a2a
commit.
--
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] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2026-01-19 14:03 ` Andrea Cervesato via ltp
@ 2026-01-20 9:59 ` Petr Vorel
2026-01-20 10:43 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 7+ messages in thread
From: Petr Vorel @ 2026-01-20 9:59 UTC (permalink / raw)
To: Andrea Cervesato; +Cc: ltp
Hi all,
> On Mon Jan 19, 2026 at 1:39 PM CET, Cyril Hrubis wrote:
> > Hi!
> > > + .filesystems = (struct tst_fs []) {
> > > + {.type = "vfat"},
> > I wonder if we can add more filesystems here, just to make sure that we
> > run the test even when vfat is not compiled in the kernel. Does ext2
> > implement the file_set/getattr calls?
> > > + {}
> > > + },
> > Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
> vfat and ntfs are the only ones which don't support both file_setattr()
> and file_getattr(), while ext family, tmpfs and btrfs don't raise
> EOPNOTSUPP for file_getattr() only.
Interesting, I would expect vfat/ntfs would not support both. (I suppose exfat
also does not support them).
> I'm wondering if that's a bug, since
> xfs is our reference for this implementation, or this has been
> introduced in 6.18-rc2 by 7ea30958b3054f5e488fa0b33c352723f7ab3a2a
> commit.
Maybe ask Andrey Albershteyn (the author) and Christian Brauner (the committer)?
> + * Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set] return
> + * -EOPNOTSUPP".
I also wonder if any of these should be mentioned in .tags (and in the text
comment, which I find a bit redundant when we have .tags):
474b155adf392 ("fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP") # v6.17
NOTE: got reverted by 4dd5b5ac089bb in v6.18
d90ad28e8aa48 ("fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls") # v6.18
Test itself LGTM.
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Kind regards,
Petr
--
Mailing list info: https://lists.linux.it/listinfo/ltp
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2026-01-20 9:59 ` Petr Vorel
@ 2026-01-20 10:43 ` Andrea Cervesato via ltp
2026-01-20 10:55 ` Andrea Cervesato via ltp
0 siblings, 1 reply; 7+ messages in thread
From: Andrea Cervesato via ltp @ 2026-01-20 10:43 UTC (permalink / raw)
To: Petr Vorel; +Cc: ltp
On Tue Jan 20, 2026 at 10:59 AM CET, Petr Vorel wrote:
> Hi all,
>
> > On Mon Jan 19, 2026 at 1:39 PM CET, Cyril Hrubis wrote:
> > > Hi!
> > > > + .filesystems = (struct tst_fs []) {
> > > > + {.type = "vfat"},
>
> > > I wonder if we can add more filesystems here, just to make sure that we
> > > run the test even when vfat is not compiled in the kernel. Does ext2
> > > implement the file_set/getattr calls?
>
> > > > + {}
> > > > + },
>
> > > Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>
> > vfat and ntfs are the only ones which don't support both file_setattr()
> > and file_getattr(), while ext family, tmpfs and btrfs don't raise
> > EOPNOTSUPP for file_getattr() only.
>
> Interesting, I would expect vfat/ntfs would not support both. (I suppose exfat
> also does not support them).
>
> > I'm wondering if that's a bug, since
> > xfs is our reference for this implementation, or this has been
> > introduced in 6.18-rc2 by 7ea30958b3054f5e488fa0b33c352723f7ab3a2a
> > commit.
>
> Maybe ask Andrey Albershteyn (the author) and Christian Brauner (the committer)?
>
>
> > + * Regression test for "474b155adf39 - fs: make vfs_fileattr_[get|set] return
> > + * -EOPNOTSUPP".
>
> I also wonder if any of these should be mentioned in .tags (and in the text
> comment, which I find a bit redundant when we have .tags):
>
> 474b155adf392 ("fs: make vfs_fileattr_[get|set] return -EOPNOTSUPP") # v6.17
> NOTE: got reverted by 4dd5b5ac089bb in v6.18
>
> d90ad28e8aa48 ("fs: return EOPNOTSUPP from file_setattr/file_getattr syscalls") # v6.18
>
> Test itself LGTM.
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
>
> Kind regards,
> Petr
I re-checked the code and it's a correct behaviour. The reason is that
every file_setattr() call using FSX feature will cause a EOPNOTSUPP for
filesystems not support it.
file_getattr() syscall is different, because it fetches data from a
filesystem without setting anything to it.
About vfat, `struct inode_operations` in the vfat implementation is not
defining .fileattr_get and .fileattr_set attributes, so we have a
reason for having a EOPNOTSUPP.
I think my approach is wrong, because the test is not really
verifying if FSX features are tested or not, but verifying that vfat is
not implementing file_setattr/file_getattr. Hence I will change this
test, verifying file_setattr() syscall only, including all filesystems
and checking that XFS features are triggering EOPNOTSUPP, except for
XFS.
I will send a v3.
Thanks,
--
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] 7+ messages in thread
* Re: [LTP] [PATCH v2] syscalls: add file_attr05 test
2026-01-20 10:43 ` Andrea Cervesato via ltp
@ 2026-01-20 10:55 ` Andrea Cervesato via ltp
0 siblings, 0 replies; 7+ messages in thread
From: Andrea Cervesato via ltp @ 2026-01-20 10:55 UTC (permalink / raw)
To: Andrea Cervesato, Petr Vorel; +Cc: ltp
> I think my approach is wrong, because the test is not really
> verifying if FSX features are tested or not, but verifying that vfat is
> not implementing file_setattr/file_getattr. Hence I will change this
> test, verifying file_setattr() syscall only, including all filesystems
> and checking that XFS features are triggering EOPNOTSUPP, except for
Typo: here I meant "checking that FSX features are triggering EOPNOTSUPP".
--
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] 7+ messages in thread
end of thread, other threads:[~2026-01-20 10:55 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-14 7:58 [LTP] [PATCH v2] syscalls: add file_attr05 test Andrea Cervesato
2026-01-16 11:20 ` Li Wang via ltp
2026-01-19 12:39 ` Cyril Hrubis
2026-01-19 14:03 ` Andrea Cervesato via ltp
2026-01-20 9:59 ` Petr Vorel
2026-01-20 10:43 ` Andrea Cervesato via ltp
2026-01-20 10:55 ` 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