[CRIU] [PATCH 3/5] unix: add ability to set callbacks for external sockets (v2)

Pavel Emelyanov xemul at parallels.com
Fri Dec 6 00:43:35 PST 2013


On 12/06/2013 07:58 AM, Andrew Vagin wrote:
> On Thu, Dec 05, 2013 at 10:29:36PM +0400, Pavel Emelyanov wrote:
>>> @@ -469,6 +471,30 @@ int unix_receive_one(struct nlmsghdr *h, void *arg)
>>>  	return unix_collect_one(m, tb);
>>>  }
>>>  
>>> +static int try_to_dump_with_callback(struct unix_sk_desc *peer, bool *need_callback)
>>> +{
>>> +	struct unix_sk_desc *sk;
>>> +	int ret = -1;
>>> +
>>> +	*need_callback = false;
>>> +	list_for_each_entry(sk, &peer->peer_list, peer_node) {
>>> +		ret = cr_plugin_dump_unix_sk(sk->fd, sk->sd.ino, sk->peer_ino);
>>> +		if (ret == CRIU_CB_SKIP) {
>>> +			if (!*need_callback)
>>> +				return 0;
>>
>> If the very first library says "don't know this socket" we get out of this fn? Why?
> 
> If ALL librararies say "don't know this socket" for the first socket we
> get out of this fn.
> 
> We are dumping all peer-s of an external sockets and if one of peer-s
> was dumped by a library, all other should be dumped by the same labrary.

But this code tries to dump other peers with _all_ libraries again. Not
by the same library. Is it OK? Why?

> Currently the code doesn't check "the same".
> 
> 
>>
>>> +
>>> +			pr_err("The callback is not suitable for all peer sockets\n");
>>> +			return -1;
>>> +		}
>>> +		if (ret < 0)
>>> +			return -1;
>>> +
>>> +		*need_callback = true;
>>> +	}
>>> +
>>> +	return ret;
>>> +}
>>> +
> .
> 




More information about the CRIU mailing list