public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
* [LTP] [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF
@ 2026-03-18  8:24 Disha Goel
  2026-03-19 16:33 ` Cyril Hrubis
  0 siblings, 1 reply; 3+ messages in thread
From: Disha Goel @ 2026-03-18  8:24 UTC (permalink / raw)
  To: ltp; +Cc: disgoel

The ustat(2) system call is known to fail with EINVAL on Btrfs because
it uses anonymous device IDs for subvolumes, which the legacy syscall
cannot resolve to a physical block device.

Currently, this results in a TFAIL, which causes false negatives in
automated CI environments (e.g., SLES). This patch adds dynamic
filesystem detection in setup() and uses tst_brk(TCONF, ...) to
gracefully skip the test on Btrfs.

Changes:
  - Added sys/vfs.h for statfs support.
  - Implemented Btrfs magic number detection in setup().
  - Used tst_brk(TCONF, ...) to skip the test if Btrfs is detected.

Verified on:
  - SLES (Btrfs): Result is now TCONF (Skipped)
  - RHEL (XFS): Result remains TPASS

Signed-off-by: Disha Goel <disgoel@linux.ibm.com>
---
 testcases/kernel/syscalls/ustat/ustat01.c | 8 +++++++-
 testcases/kernel/syscalls/ustat/ustat02.c | 8 +++++++-
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/syscalls/ustat/ustat01.c b/testcases/kernel/syscalls/ustat/ustat01.c
index 161006058..07ee2faf7 100644
--- a/testcases/kernel/syscalls/ustat/ustat01.c
+++ b/testcases/kernel/syscalls/ustat/ustat01.c
@@ -13,6 +13,7 @@
 #include <errno.h>
 #include <sys/types.h>
 #include <sys/stat.h>
+#include <sys/vfs.h>
 
 #include "lapi/syscalls.h"
 #include "lapi/ustat.h"
@@ -34,11 +35,16 @@ void run(void)
 static void setup(void)
 {
 	struct stat buf;
+	struct statfs fs_buf;
 
 	/* Find a valid device number */
 	SAFE_STAT("/", &buf);
-
 	dev_num = buf.st_dev;
+
+	statfs("/", &fs_buf);
+	if (fs_buf.f_type == 0x9123683E) {
+		tst_brk(TCONF, "%s", test.tags[0].value);
+	}
 }
 
 static struct tst_test test = {
diff --git a/testcases/kernel/syscalls/ustat/ustat02.c b/testcases/kernel/syscalls/ustat/ustat02.c
index 84becaa1f..789ef57fc 100644
--- a/testcases/kernel/syscalls/ustat/ustat02.c
+++ b/testcases/kernel/syscalls/ustat/ustat02.c
@@ -14,6 +14,7 @@
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/types.h>
+#include <sys/vfs.h>
 
 #include "lapi/syscalls.h"
 #include "lapi/ustat.h"
@@ -50,11 +51,16 @@ void run(unsigned int test)
 static void setup(void)
 {
 	struct stat buf;
+	struct statfs fs_buf;
 
 	/* Find a valid device number */
 	SAFE_STAT("/", &buf);
-
 	root_dev = buf.st_dev;
+
+	statfs("/", &fs_buf);
+	if (fs_buf.f_type == 0x9123683E) {
+		tst_brk(TCONF, "%s", test.tags[0].value);
+	}
 }
 
 static struct tst_test test = {
-- 
2.45.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF
  2026-03-18  8:24 [LTP] [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF Disha Goel
@ 2026-03-19 16:33 ` Cyril Hrubis
  2026-03-23  8:43   ` Disha Goel
  0 siblings, 1 reply; 3+ messages in thread
From: Cyril Hrubis @ 2026-03-19 16:33 UTC (permalink / raw)
  To: Disha Goel; +Cc: ltp

Hi!
> The ustat(2) system call is known to fail with EINVAL on Btrfs because
> it uses anonymous device IDs for subvolumes, which the legacy syscall
> cannot resolve to a physical block device.
> 
> Currently, this results in a TFAIL, which causes false negatives in
> automated CI environments (e.g., SLES). This patch adds dynamic
> filesystem detection in setup() and uses tst_brk(TCONF, ...) to
> gracefully skip the test on Btrfs.

That's why the test has known-fail tag, but maybe it's time to accept
that ustat() is broken on Btrfs and it's not going to get fixed.

However we do have .skip_filesystems in tst_test structure exactly for
cases like that, so it should be used instead.

-- 
Cyril Hrubis
chrubis@suse.cz

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [LTP] [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF
  2026-03-19 16:33 ` Cyril Hrubis
@ 2026-03-23  8:43   ` Disha Goel
  0 siblings, 0 replies; 3+ messages in thread
From: Disha Goel @ 2026-03-23  8:43 UTC (permalink / raw)
  To: Cyril Hrubis; +Cc: ltp

On 19/03/26 10:03 pm, Cyril Hrubis wrote:
> Hi!
>> The ustat(2) system call is known to fail with EINVAL on Btrfs because
>> it uses anonymous device IDs for subvolumes, which the legacy syscall
>> cannot resolve to a physical block device.
>>
>> Currently, this results in a TFAIL, which causes false negatives in
>> automated CI environments (e.g., SLES). This patch adds dynamic
>> filesystem detection in setup() and uses tst_brk(TCONF, ...) to
>> gracefully skip the test on Btrfs.
> 
> That's why the test has known-fail tag, but maybe it's time to accept
> that ustat() is broken on Btrfs and it's not going to get fixed.
> 
> However we do have .skip_filesystems in tst_test structure exactly for
> cases like that, so it should be used instead.
> 
Hi Cyril,

Thank you for the review.

I will refactor both ustat01 and ustat02 to use .skip_filesystems and 
send a v2.

-- 
Regards,
Disha


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-03-23  8:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-18  8:24 [LTP] [PATCH] syscalls/ustat: Skip tests on Btrfs using TCONF Disha Goel
2026-03-19 16:33 ` Cyril Hrubis
2026-03-23  8:43   ` Disha Goel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox