Skip to contentSkip to conversation

statx07: Skip test if NFS server is never enabled

PATCH In review Li Wang 3 participants 5 messages Feb 11, 2025 – Feb 14, 2025

lore
Share & tools
lore

Li Wang

author
#0 lore raw

PATCH 1/1 statx07: Skip test if NFS server is never enabled

The statx07 test requires an active NFS server, as it relies on exportfs, which reads from '/var/lib/nfs/etab'. By default, etab file does not exist unless the NFS server is started at least once (since new version nfs-utils-2.5.4-32.el9).

This causing the test to fail when etab is missing:

tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s tst_buffers.c:57: TINFO: Test is using guarded buffers
exportfs: can't open /var/lib/nfs/etab for reading statx07.c:136: TBROK: failed to exportfs

This patch adds a check using access("/var/lib/nfs/etab", F_OK) before running the test. If the file does not exist, the test is skipped (TCONF) instead of failing, preventing misleading test failures.

Cc Yongcheng Yang <[email protected]>
---
 testcases/kernel/syscalls/statx/statx07.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/statx/statx07.c +3 -0
index 968174330..bc8e6fd65 100644
@@ -115,6 +115,9 @@ static void setup(void)
 	int ret;
 	char server_path[BUFF_SIZE];
 
+	if (access("/var/lib/nfs/etab", F_OK) < 0)
+		tst_brk(TCONF, "nfs-server might not set up");
+
 	mode_t old_umask = umask(0);
 
 	SAFE_MKDIR(SERV_PATH, DEFAULT_MODE);
Signature · 5 lines
2.48.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
#1 lore raw

Hi Li, all,

Quoted 28 lines

The statx07 test requires an active NFS server, as it relies on exportfs, which reads from '/var/lib/nfs/etab'. By default, etab file does not exist unless the NFS server is started at least once (since new version nfs-utils-2.5.4-32.el9).

This causing the test to fail when etab is missing:

tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s tst_buffers.c:57: TINFO: Test is using guarded buffers
exportfs: can't open /var/lib/nfs/etab for reading statx07.c:136: TBROK: failed to exportfs

This patch adds a check using access("/var/lib/nfs/etab", F_OK) before running the test. If the file does not exist, the test is skipped (TCONF) instead of failing, preventing misleading test failures.

Cc Yongcheng Yang <[email protected]>
---
 testcases/kernel/syscalls/statx/statx07.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/statx/statx07.c +0 -0
index 968174330..bc8e6fd65 100644

testcases/kernel/syscalls/statx/statx07.c static void setup(void) · line 119

Quoted 5 lines
testcases/kernel/syscalls/statx/statx07.c +2 -0
@@ -115,6 +115,9 @@ static void setup(void)
 	int ret;
 	char server_path[BUFF_SIZE];
 
+	if (access("/var/lib/nfs/etab", F_OK) < 0)
+		tst_brk(TCONF, "nfs-server might not set up");

On Tumbleweed with nfs-client-2.8.1-44.2.x86_64:

# systemctl stop nfs-server.service
# ./statx07
...
tst_test.c:1904: TINFO: Tested kernel: 6.13.0-2.g0127a37-default #1 SMP PREEMPT_DYNAMIC Thu Jan 23 11:21:55 UTC 2025 (0127a37) x86_64
...
statx07.c:141: TCONF: nfs server not set up?: EOPNOTSUPP (95)
$ ls -la /var/lib/nfs/etab

The same behavior is on older systems (I checked SLE15-SP4 with 5.14 based kernel and nfs-client-2.1.1).

There is a working detection. I wonder what is different on the system you test. OTOH fortunately this patch would not break SLES/openSUSE (it would just not help to detect), therefore I'm not against it.

Kind regards,
Petr

Quoted 4 lines
testcases/kernel/syscalls/statx/statx07.c +1 -0
+
 	mode_t old_umask = umask(0);
 
 	SAFE_MKDIR(SERV_PATH, DEFAULT_MODE);
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
#2 lore raw

Hi Petr,

Quoted 45 lines · Petr Vorel

Hi Li, all,

Quoted 28 lines

The statx07 test requires an active NFS server, as it relies on exportfs, which reads from '/var/lib/nfs/etab'. By default, etab file does not exist unless the NFS server is started at least once (since new version nfs-utils-2.5.4-32.el9).

This causing the test to fail when etab is missing:

tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s tst_buffers.c:57: TINFO: Test is using guarded buffers
exportfs: can't open /var/lib/nfs/etab for reading statx07.c:136: TBROK: failed to exportfs

This patch adds a check using access("/var/lib/nfs/etab", F_OK) before running the test. If the file does not exist, the test is skipped (TCONF) instead of failing, preventing misleading test failures.

Cc Yongcheng Yang <[email protected]>
---
 testcases/kernel/syscalls/statx/statx07.c | 3 +++
 1 file changed, 3 insertions(+)
testcases/kernel/syscalls/statx/statx07.c +0 -0
index 968174330..bc8e6fd65 100644

testcases/kernel/syscalls/statx/statx07.c static void setup(void) · line 119

Quoted 5 lines
testcases/kernel/syscalls/statx/statx07.c +2 -0
@@ -115,6 +115,9 @@ static void setup(void)
 	int ret;
 	char server_path[BUFF_SIZE];
 
+	if (access("/var/lib/nfs/etab", F_OK) < 0)
+		tst_brk(TCONF, "nfs-server might not set up");

On Tumbleweed with nfs-client-2.8.1-44.2.x86_64:

# systemctl stop nfs-server.service
# ./statx07
...
tst_test.c:1904: TINFO: Tested kernel: 6.13.0-2.g0127a37-default #1 SMP PREEMPT_DYNAMIC Thu Jan 23 11:21:55 UTC 2025 (0127a37) x86_64
...
statx07.c:141: TCONF: nfs server not set up?: EOPNOTSUPP (95)
Quoted 8 lines
$ ls -la /var/lib/nfs/etab

The same behavior is on older systems (I checked SLE15-SP4 with 5.14 based kernel and nfs-client-2.1.1).

There is a working detection. I wonder what is different on the system you test. OTOH fortunately this patch would not break SLES/openSUSE (it would just not help to detect), therefore I'm not against it.

This is for an update of the nfs-utils spec file, see
https://src.fedoraproject.org/rpms/nfs-utils/c/eea36e50024efbac78514f96a29f05306905118b?//branch=rawhide

Now /var/lib/nfs/etab and /var/lib/nfs/rmtab are marked as %config files and they will not be created when nfs-utils is just installed.

Best Regards,
Yongcheng

Quoted 9 lines

Kind regards,
Petr

Quoted 4 lines
testcases/kernel/syscalls/statx/statx07.c +1 -0
+
 	mode_t old_umask = umask(0);
 
 	SAFE_MKDIR(SERV_PATH, DEFAULT_MODE);
Signature · 1 line
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#3 lore raw
Quoted 60 lines · Yongcheng Yang

Hi Petr,

Quoted 19 lines · Petr Vorel

Hi Li, all,

Quoted 16 lines

The statx07 test requires an active NFS server, as it relies on exportfs, which reads from '/var/lib/nfs/etab'. By default, etab file does not exist unless the NFS server is started at least once (since new version nfs-utils-2.5.4-32.el9).

This causing the test to fail when etab is missing:

tst_test.c:1722: TINFO: Overall timeout per run is 0h 00m 30s tst_buffers.c:57: TINFO: Test is using guarded buffers
exportfs: can't open /var/lib/nfs/etab for reading statx07.c:136: TBROK: failed to exportfs

This patch adds a check using access("/var/lib/nfs/etab", F_OK) before running the test. If the file does not exist, the test is skipped (TCONF) instead of failing, preventing misleading test failures.

Quoted 7 lines

Review

Quoted 7 lines
Cc Yongcheng Yang <[email protected]>
---
 testcases/kernel/syscalls/statx/statx07.c | 3 +++
 1 file changed, 3 insertions(+)
(quoted diff) +0 -0

b/testcases/kernel/syscalls/statx/statx07.c

Quoted 10 lines

testcases/kernel/syscalls/statx/statx07.c static void setup(void) · line 119

Quoted 9 lines

index 968174330..bc8e6fd65 100644

testcases/kernel/syscalls/statx/statx07.c +2 -0
@@ -115,6 +115,9 @@ static void setup(void)
    int ret;
    char server_path[BUFF_SIZE];
 
+   if (access("/var/lib/nfs/etab", F_OK) < 0)
+           tst_brk(TCONF, "nfs-server might not set up");
Quoted 6 lines

On Tumbleweed with nfs-client-2.8.1-44.2.x86_64:

# systemctl stop nfs-server.service
# ./statx07
...
tst_test.c:1904: TINFO: Tested kernel: 6.13.0-2.g0127a37-default #1 SMP

PREEMPT_DYNAMIC Thu Jan 23 11:21:55 UTC 2025 (0127a37) x86_64

Quoted 6 lines

...
statx07.c:141: TCONF: nfs server not set up?: EOPNOTSUPP (95)

$ ls -la /var/lib/nfs/etab

The same behavior is on older systems (I checked SLE15-SP4 with 5.14

based

Quoted 3 lines

kernel and nfs-client-2.1.1).

There is a working detection. I wonder what is different on the system

you test.

Quoted 1 line

OTOH fortunately this patch would not break SLES/openSUSE (it would just

not

Quoted 9 lines
Quoted 1 line

help to detect), therefore I'm not against it.

This is for an update of the nfs-utils spec file, see

https://src.fedoraproject.org/rpms/nfs-utils/c/eea36e50024efbac78514f96a29f05306905118b?//branch=rawhide

Now /var/lib/nfs/etab and /var/lib/nfs/rmtab are marked as %config files and they will not be created when nfs-utils is just installed.

Ture, so if statx07 test on a system never starts nfs service, which the etab file is not being created, it would be failed like that.

Once we start and then stop the nfs service the problem disappears because etab file is created by the starting process.

That's why I sent the config file detection additionally.

Quoted 15 lines

Best Regards,
Yongcheng

Quoted 9 lines

Kind regards,
Petr

Quoted 4 lines
testcases/kernel/syscalls/statx/statx07.c +1 -0
+
    mode_t old_umask = umask(0);
 
    SAFE_MKDIR(SERV_PATH, DEFAULT_MODE);
Signature · 5 lines
Regards,
Li Wang

-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
author
#4 lore raw

Pushed, thanks.

Signature · 5 lines
Regards,
Li Wang

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