[PATCH] syscalls/file_attr01: Fix EOPNOTSUPP expectation on tmpfs

Wake Liu via ltp <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
The test was expecting EOPNOTSUPP when ufattr is NULL on tmpfs without
xattr support. However, file_setattr() always copy structure from
userspace early (via copy_struct_from_user) and returns EFAULT if the
pointer is invalid, before checking filesystem xattr support.

Therefore, the EOPNOTSUPP exception is only valid for file_getattr()
which does not read from ufattr early.

Restrict the EOPNOTSUPP expectation to file_getattr() (tst_variant != 0)
to avoid false failures on file_setattr().

Signed-off-by: Wake Liu <[email protected]>
---
 testcases/kernel/syscalls/file_attr/file_attr01.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/testcases/kernel/syscalls/file_attr/file_attr01.c b/testcases/kernel/syscalls/file_attr/file_attr01.c
index 419d54c36..2e6c07d07 100644
--- a/testcases/kernel/syscalls/file_attr/file_attr01.c
+++ b/testcases/kernel/syscalls/file_attr/file_attr01.c
@@ -119,7 +119,7 @@ static void run(unsigned int i)
 	struct tcase *tc = &tcases[i];
 	int exp_errno = tc->exp_errno;
 
-	if (tc->ufattr == (struct file_attr **)(&null_ptr) && missing_tmpfs_xattr)
+	if (tc->ufattr == (struct file_attr **)(&null_ptr) && missing_tmpfs_xattr && tst_variant)
 		exp_errno = EOPNOTSUPP;
 
 	if (tst_variant) {
-- 
2.55.0.654.g21b8a5bc05-goog


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.