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

Andrew Vagin avagin at parallels.com
Fri Dec 6 01:20:30 PST 2013


On Fri, Dec 06, 2013 at 12:43:35PM +0400, Pavel Emelyanov wrote:
> 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?

It's OK, if libraries will handle only own sockets. We can use the same
library for all socket, but the code will be a bit more complicated.

> 
> > 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