[CRIU] [PATCH] zdtm.py: umount root only if it was mounted

Tycho Andersen tycho.andersen at canonical.com
Tue Nov 24 07:32:29 PST 2015


On Tue, Nov 24, 2015 at 12:13:31PM +0300, Andrey Vagin wrote:
> From: Andrew Vagin <avagin at virtuozzo.com>
> 
> We get the stack trace if a test failed:
> 
> Test output: ================================
> 09:11:34.584:     4: PASS
> 
>  <<< ================================
> Traceback (most recent call last):
>   File "zdtm.py", line 922, in <module>
>     do_run_test(tinfo[0], tinfo[1], tinfo[2], tinfo[3])
>   File "zdtm.py", line 696, in do_run_test
>     t.kill()
>   File "zdtm.py", line 302, in kill
>     self.__flavor.fini()
>   File "zdtm.py", line 168, in fini
>     subprocess.check_call(["mount", "--make-private", self.root])
>   File "/usr/lib64/python2.7/subprocess.py", line 540, in check_call
>     raise CalledProcessError(retcode, cmd)
> subprocess.CalledProcessError: Command '['mount', '--make-private', '/tmp/criu-root-YN1t3X']' returned non-zero exit status 32
> umount: /tmp/criu-root-YN1t3X: not mounted
> 
> Cc: Tycho Andersen <tycho.andersen at canonical.com>

Acked-by: Tycho Andersen <tycho.andersen at canonical.com>

Thanks, I'll drop this patch from my series.

> Signed-off-by: Andrew Vagin <avagin at virtuozzo.com>
> ---
>  test/zdtm.py | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/test/zdtm.py b/test/zdtm.py
> index b5f3513..9f3f049 100755
> --- a/test/zdtm.py
> +++ b/test/zdtm.py
> @@ -108,6 +108,7 @@ class ns_flavor:
>  		self.ns = True
>  		self.uns = False
>  		self.root = make_tests_root()
> +		self.root_mounted = False
>  
>  	def __copy_one(self, fname):
>  		if not os.access(fname, os.F_OK):
> @@ -143,6 +144,7 @@ class ns_flavor:
>  
>  	def init(self, test_bin, deps):
>  		subprocess.check_call(["mount", "--make-private", "--bind", ".", self.root])
> +		self.root_mounted = True
>  
>  		if not os.access(self.root + "/.constructed", os.F_OK):
>  			with open(os.path.abspath(__file__)) as o:
> @@ -165,8 +167,10 @@ class ns_flavor:
>  			self.__copy_libs(dep)
>  
>  	def fini(self):
> -		subprocess.check_call(["mount", "--make-private", self.root])
> -		subprocess.check_call(["umount", "-l", self.root])
> +		if self.root_mounted:
> +			subprocess.check_call(["mount", "--make-private", self.root])
> +			subprocess.check_call(["umount", "-l", self.root])
> +			self.root_mounted = False
>  
>  class userns_flavor(ns_flavor):
>  	def __init__(self, opts):
> -- 
> 2.4.3
> 


More information about the CRIU mailing list