[CRIU] [PATCH v4 04/15] unix: Link all sockets in unix_sockets list

Kirill Tkhai ktkhai at virtuozzo.com
Tue Nov 29 02:50:49 PST 2016



On 23.11.2016 12:01, Pavel Emelyanov wrote:
> On 06/01/2016 07:02 PM, Kirill Tkhai wrote:
>> List "unix_sockets" is used to link external sockets.
>> Change this, to link all unix sockets there. To differ
>> really external sockets in fix_external_unix_sockets(),
>> we may check for socket's already_dumped value.
>>
>> This may be useful to traverse over all unix sockets
>> in a namespace.
>>
>> Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>
> 
> Heh :) This patch results in a weird effect. Look:
> 
> 	# ./test/zdtm.py run -t zdtm/static/env00 -f h --keep-img always
> 	...
> 	# ls dump/zdtm/static/env00/39/1/
> 	...
> 	unixsk.img
> 
> The problem is that the amount of unix sockets involved in env00 test is zero,
> but for some reason sk-unix.c decides to write into images one external unix sk
> entry which is not referenced by anybody.
> 
> The patch id is c085d6af6d5, merged into 2.4.

Below is the fix

[PATCH] unix: Do not dump unused external sockets

Do not dump external sockets, that are not peers
for some processes sockets. We do not use them on
restore ==> we do not need to dump them.

Signed-off-by: Kirill Tkhai <ktkhai at virtuozzo.com>

 criu/sk-unix.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/criu/sk-unix.c b/criu/sk-unix.c
index 202228d..5cbe07a 100644
--- a/criu/sk-unix.c
+++ b/criu/sk-unix.c
@@ -743,7 +743,8 @@ int fix_external_unix_sockets(void)
 		FownEntry fown = FOWN_ENTRY__INIT;
 		SkOptsEntry skopts = SK_OPTS_ENTRY__INIT;
 
-		if (sk->sd.already_dumped)
+		if (sk->sd.already_dumped ||
+		    list_empty(&sk->peer_list))
 			continue;
 
 		show_one_unix("Dumping extern", sk);



More information about the CRIU mailing list