public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [tests/selinux] main: Manually watchdog mount nfs fs
@ 2026-09-10  8:56 Petr Lautrbach
  0 siblings, 0 replies; only message in thread
From: Petr Lautrbach @ 2026-09-10  8:56 UTC (permalink / raw)
  To: git-commits

            A new commit has been pushed.

            Repo   : tests/selinux
            Branch : main
            Commit : c9f49d075cf421da4e2c3b8572b7bb2d8d5037e1
            Author : Petr Lautrbach <lautrbach@redhat.com>
            Date   : 2026-09-10T08:55:43+00:00
            Stats  : +14/-5 in 1 file(s)
            URL    : https://src.fedoraproject.org/tests/selinux/c/c9f49d075cf421da4e2c3b8572b7bb2d8d5037e1?branch=main

            Log:
            Manually watchdog mount nfs fs

There's a bug [1] in recent nfs-utils which causes hang of `mount`
command. For this test it means that the test is killed when maximum
test time '10m' exceeded. But there's no cleanup and so next test which
grep's for 'selinux' in mounted filesystems incorrectly finds leftovers
from this test.

This change tries to workaround described problem using its own watchdog
and cleaning up when `mount 127.0.0.1:/selinux $STORE_ROOT` does not
finish in 15 seconds

[1] https://bugzilla.redhat.com/show_bug.cgi?id=2525909

---
diff --git a/libsemanage/semanage-root-on-nfs/test.sh b/libsemanage/semanage-root-on-nfs/test.sh
index d7c944a..02c7e8f 100755
--- a/libsemanage/semanage-root-on-nfs/test.sh
+++ b/libsemanage/semanage-root-on-nfs/test.sh
@@ -8,6 +8,14 @@ if [ -z "$STORE_ROOT" ]; then
     STORE_ROOT=/var/lib/selinux
 fi
 
+clean_nfs() {
+        rlLog "Cleanup nfs mounts and mount points"
+        rlRun "umount $STORE_ROOT"
+        rlRun "systemctl disable nfs-server --now"
+        rlRun "umount /srv/nfs/selinux"
+        rlRun "rm -rf /srv"
+}
+
 rlJournalStart
     rlPhaseStartSetup
         rlRun "tmp=\$(mktemp -d)" 0 "Create tmp directory"
@@ -25,7 +33,11 @@ rlJournalStart
 EOF"
         rlRun "exportfs -a"
         rlRun "showmount -e 127.0.0.1"
-        rlRun "mount 127.0.0.1:/selinux $STORE_ROOT"
+        rlWatchdog 'mount 127.0.0.1:/selinux $STORE_ROOT' 15 KILL
+        if ! mountpoint -q "$STORE_ROOT"; then
+            clean_nfs
+            rlDie "NFS mount did not finish successfully"
+        fi
     rlPhaseEnd
 
     rlPhaseStartTest "semanage root on nfs"
@@ -34,10 +46,7 @@ EOF"
     rlPhaseEnd
 
     rlPhaseStartCleanup
-        rlRun "umount $STORE_ROOT"
-        rlRun "systemctl disable nfs-server --now"
-        rlRun "umount /srv/nfs/selinux"
-        rlRun "rm -rf /srv"
+        clean_nfs
         rlRun "popd"
         rlRun "rm -r $tmp" 0 "Remove tmp directory"
     rlPhaseEnd

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-09-10  8:56 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-10  8:56 [tests/selinux] main: Manually watchdog mount nfs fs Petr Lautrbach

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