[LTP] [PATCH] statx04: mask STATX_ATTR_COMPRESSED on tmpfs

Li Wang liwang@redhat.com
Thu Aug 18 11:50:30 CEST 2022


Recently a new kernel commit (e408e695f) introduces the inode attributes
being supported in tmpfs, which is like other Linux file systems. But that
caused statx04 to throw an unsupported error in STATX_ATTR_COMPRESSED.

This patch help masks it just like what we did for XFS.

    tst_test.c:1599: TINFO: Testing on tmpfs
    tst_test.c:1064: TINFO: Skipping mkfs for TMPFS filesystem
    tst_test.c:1045: TINFO: Limiting tmpfs size to 32MB
    statx04.c:114: TFAIL: STATX_ATTR_COMPRESSED not supported
    statx04.c:112: TPASS: STATX_ATTR_APPEND is supported
    statx04.c:112: TPASS: STATX_ATTR_IMMUTABLE is supported
    statx04.c:112: TPASS: STATX_ATTR_NODUMP is supported

Signed-off-by: Li Wang <liwang@redhat.com>
---
 testcases/kernel/syscalls/statx/statx04.c | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/statx/statx04.c b/testcases/kernel/syscalls/statx/statx04.c
index 083298310..03d909534 100644
--- a/testcases/kernel/syscalls/statx/statx04.c
+++ b/testcases/kernel/syscalls/statx/statx04.c
@@ -17,7 +17,7 @@
  * xfs filesystem doesn't support STATX_ATTR_COMPRESSED flag, so we only test
  * three other flags.
  *
- * ext2, ext4, btrfs and xfs support statx syscall since the following commit
+ * ext2, ext4, btrfs, xfs and tmpfs support statx syscall since the following commit
  *
  *  commit 93bc420ed41df63a18ae794101f7cbf45226a6ef
  *  Author: yangerkun <yangerkun@huawei.com>
@@ -42,6 +42,13 @@
  *  Date:   Fri Mar 31 18:32:03 2017 +0100
  *
  *  xfs: report crtime and attribute flags to statx
+ *
+ *  commit e408e695f5f1f60d784913afc45ff2c387a5aeb8
+ *  Author: Theodore Ts'o <tytso@mit.edu>
+ *  Date:   Thu Jul 14 21:59:12 2022 -0400
+ *
+ *  mm/shmem: support FS_IOC_[SG]ETFLAGS in tmpfs
+ *
  */
 
 #define _GNU_SOURCE
@@ -88,8 +95,8 @@ static void setup(void)
 	for (i = 0, expected_mask = 0; i < ARRAY_SIZE(attr_list); i++)
 		expected_mask |= attr_list[i].attr;
 
-	/* STATX_ATTR_COMPRESSED not supported on XFS */
-	if (!strcmp(tst_device->fs_type, "xfs"))
+	/* STATX_ATTR_COMPRESSED not supported on XFS, TMPFS */
+	if (!strcmp(tst_device->fs_type, "xfs") || !strcmp(tst_device->fs_type, "tmpfs"))
 		expected_mask &= ~STATX_ATTR_COMPRESSED;
 
 	/* Attribute support was added to Btrfs statx() in kernel v4.13 */
-- 
2.35.3



More information about the ltp mailing list