diff --git a/test/Makefile b/test/Makefile index 22fcf711d..20336b7b4 100644 --- a/test/Makefile +++ b/test/Makefile @@ -21,6 +21,8 @@ other: zdtm_ct: zdtm_ct.c +umount2: umount2 + zdtm: ./zdtm.py run -a --parallel 2 .PHONY: zdtm @@ -53,7 +55,7 @@ clean_root: .PHONY: clean_root clean: clean_root - $(RM) zdtm_ct zdtm-tst-list + $(RM) zdtm_ct zdtm-tst-list umount2 $(Q) $(RM) *.log $(Q) $(RM) -r ./dump/ $(Q) $(MAKE) -C zdtm cleandep clean cleanout diff --git a/test/umount2.c b/test/umount2.c new file mode 100644 index 000000000..a150f341d --- /dev/null +++ b/test/umount2.c @@ -0,0 +1,16 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + if (argc < 2) { + fprintf(stderr, "umount PATH\n"); + return 1; + } + if (umount2(argv[1], MNT_DETACH)) { + fprintf(stderr, "umount %s: %m\n", argv[1]); + return 1; + } + + return 0; +} diff --git a/test/zdtm.py b/test/zdtm.py index 25b54ef42..29302a015 100755 --- a/test/zdtm.py +++ b/test/zdtm.py @@ -246,8 +246,7 @@ class ns_flavor: def fini(self): if self.root_mounted: - subprocess.check_call(["mount", "--make-private", self.root]) - subprocess.check_call(["umount", "-l", self.root]) + subprocess.check_call(["./umount2", self.root]) self.root_mounted = False @staticmethod @@ -510,6 +509,8 @@ class zdtm_test: @staticmethod def available(): + if not os.access("umount2", os.X_OK): + subprocess.check_call(["make", "umount2"]) if not os.access("zdtm_ct", os.X_OK): subprocess.check_call(["make", "zdtm_ct"]) if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK):