2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-22 01:51:51 +00:00

zdtm: add a program to umount a test root

This program doesn't parse /etc/fstab or /etc/mtab,
it just calls the umount2 syscall.

It is another attempt to fix the error:
subprocess.CalledProcessError: Command '['mount', '--make-private', '/tmp/criu-root-C7MZS9']' returned non-zero exit status 1
OSError: [Errno 16] Device or resource busy: '/tmp/criu-root-C7MZS9'

Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Andrei Vagin <avagin@virtuozzo.com>
Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
This commit is contained in:
Andrei Vagin 2016-09-02 00:50:00 +03:00 committed by Pavel Emelyanov
parent 3b366c3141
commit 2dc2d8c56f
3 changed files with 22 additions and 3 deletions

View File

@ -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

16
test/umount2.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
#include <sys/mount.h>
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;
}

View File

@ -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):