mirror of
https://github.com/checkpoint-restore/criu
synced 2025-08-29 13:28:27 +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:
parent
3b366c3141
commit
2dc2d8c56f
@ -21,6 +21,8 @@ other:
|
|||||||
|
|
||||||
zdtm_ct: zdtm_ct.c
|
zdtm_ct: zdtm_ct.c
|
||||||
|
|
||||||
|
umount2: umount2
|
||||||
|
|
||||||
zdtm:
|
zdtm:
|
||||||
./zdtm.py run -a --parallel 2
|
./zdtm.py run -a --parallel 2
|
||||||
.PHONY: zdtm
|
.PHONY: zdtm
|
||||||
@ -53,7 +55,7 @@ clean_root:
|
|||||||
.PHONY: clean_root
|
.PHONY: clean_root
|
||||||
|
|
||||||
clean: clean_root
|
clean: clean_root
|
||||||
$(RM) zdtm_ct zdtm-tst-list
|
$(RM) zdtm_ct zdtm-tst-list umount2
|
||||||
$(Q) $(RM) *.log
|
$(Q) $(RM) *.log
|
||||||
$(Q) $(RM) -r ./dump/
|
$(Q) $(RM) -r ./dump/
|
||||||
$(Q) $(MAKE) -C zdtm cleandep clean cleanout
|
$(Q) $(MAKE) -C zdtm cleandep clean cleanout
|
||||||
|
16
test/umount2.c
Normal file
16
test/umount2.c
Normal 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;
|
||||||
|
}
|
@ -246,8 +246,7 @@ class ns_flavor:
|
|||||||
|
|
||||||
def fini(self):
|
def fini(self):
|
||||||
if self.root_mounted:
|
if self.root_mounted:
|
||||||
subprocess.check_call(["mount", "--make-private", self.root])
|
subprocess.check_call(["./umount2", self.root])
|
||||||
subprocess.check_call(["umount", "-l", self.root])
|
|
||||||
self.root_mounted = False
|
self.root_mounted = False
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -510,6 +509,8 @@ class zdtm_test:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def available():
|
def available():
|
||||||
|
if not os.access("umount2", os.X_OK):
|
||||||
|
subprocess.check_call(["make", "umount2"])
|
||||||
if not os.access("zdtm_ct", os.X_OK):
|
if not os.access("zdtm_ct", os.X_OK):
|
||||||
subprocess.check_call(["make", "zdtm_ct"])
|
subprocess.check_call(["make", "zdtm_ct"])
|
||||||
if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK):
|
if not os.access("zdtm/lib/libzdtmtst.a", os.F_OK):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user