[CRIU] [PATCH] zdtm: Unlink link_remap files once dump complete

Andrew Vagin avagin at parallels.com
Wed Feb 6 10:18:38 EST 2013


On Wed, Feb 06, 2013 at 05:14:12PM +0400, Cyrill Gorcunov wrote:
> 
> In case if only "dump" procedure is invoked we left service
> "link_remap.%d" file(s) on disk. This prevents next "dump"
> procedure of same test to fail because we hit the situation
> where same named "link_remap.%d" already exist.
> 
> So, if test is passed with "-d" option we remove the link remap
> file at the end.
> 
> Also with this patch we start passing --link-remap option
> only for tests which have "unlink_" prefix in name. This applies
> some limitation on how test could be named, thus maybe we need
> more flexible solution here.
> 
> https://bugzilla.openvz.org/show_bug.cgi?id=2489
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  test/zdtm.sh | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 

> diff --git a/test/zdtm.sh b/test/zdtm.sh
> index 2c91793..f469786 100755
> --- a/test/zdtm.sh
> +++ b/test/zdtm.sh
> @@ -266,6 +266,13 @@ diff_fds()
>  run_test()
>  {
>  	local test=$1
> +	local linkremap=
> +
> +	#
> +	# add option for unlinked files test
> +	if [[ $1 =~ "unlink_" ]]; then

I'm not sure, that this is good idea. We may have unlink_socket for
example. I can suggest to create a new list and then if a test is in
this list, --link-remap is added

> +		linkremap="--link-remap"
> +	fi

I think we can move this code a bit lower and add --link-remap to $args

>  
>  	[ -n "$MAINSTREAM_KERNEL" ] && echo $TEST_CR_KERNEL | grep -q ${test#ns/} && {
>  		echo "Skip $test"
> @@ -312,7 +319,8 @@ EOF
>  	mkdir -p $ddump
>  
>  	save_fds $PID  $ddump/dump.fd
> -	setsid $CRTOOLS_CPT dump --file-locks --tcp-established --link-remap -x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
> +	setsid $CRTOOLS_CPT dump $opts --file-locks --tcp-established $linkremap \
> +		-x --evasive-devices -D $ddump -o dump.log -v 4 -t $PID $args $ARGS || {
>  		echo WARNING: process $tname is left running for your debugging needs
>  		return 1
>  	}
> @@ -321,6 +329,10 @@ EOF
>  		save_fds $PID  $ddump/dump.fd.after
>  		diff_fds $ddump/dump.fd $ddump/dump.fd.after || return 1
>  		killall -CONT $tname
> +		if [[ $linkremap ]]; then
> +			echo "remove ./$tdir/link_remap.*"
> +			rm -f ./$tdir/link_remap.*
> +		fi
>  	else
>  		# Wait while tasks are dying, otherwise PIDs would be busy.
>  		for i in $ddump/core-*.img; do



More information about the CRIU mailing list