[CRIU] [PATCH 11/18] sk-unix: Use add_post_prepare_cb_once helper

Kirill Tkhai ktkhai at virtuozzo.com
Mon Apr 24 03:28:14 PDT 2017


On 12.04.2017 16:58, Cyrill Gorcunov wrote:
> And no need for ui->ue->peer peer, the resolve_unix_peers

ui->ue->peer is an optimization to do not iterate over socket
list. I also think it's not need in common case, in a CT. Are
there are many CTs, which are not having a socket with a peer?!
It seems, no. So, I more likely agree with Cyrill.

> will do it anyway.
> 
> Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
> ---
>  criu/sk-unix.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/criu/sk-unix.c b/criu/sk-unix.c
> index d85356d890c1..8426e7ceafc7 100644
> --- a/criu/sk-unix.c
> +++ b/criu/sk-unix.c
> @@ -1372,18 +1372,14 @@ static int resolve_unix_peers(void *unused);
>  static int collect_one_unixsk(void *o, ProtobufCMessage *base, struct cr_img *i)
>  {
>  	struct unix_sk_info *ui = o;
> -	static bool post_queued = false;
>  	char *uname, *prefix = "";
>  	int ulen;
>  
>  	ui->ue = pb_msg(base, UnixSkEntry);
>  	ui->name_dir = (void *)ui->ue->name_dir;
>  
> -	if (ui->ue->peer && !post_queued) {
> -		post_queued = true;
> -		if (add_post_prepare_cb(resolve_unix_peers, NULL))
> -			return -1;
> -	}
> +	if (add_post_prepare_cb_once(resolve_unix_peers, NULL))
> +		return -1;
>  
>  	if (ui->ue->name.len) {
>  		if (ui->ue->name.len > UNIX_PATH_MAX) {
> 


More information about the CRIU mailing list