[CRIU] Re: [PATCH 1/2] sockets: Restore unbound inet sockets
v3
Pavel Emelyanov
xemul at parallels.com
Thu Jun 28 13:12:36 EDT 2012
On 06/27/2012 10:14 PM, Cyrill Gorcunov wrote:
> On Wed, Jun 27, 2012 at 09:13:19PM +0400, Pavel Emelyanov wrote:
>>> + /*
>>> + * The restored application will pass backlog explicitly
>>> + * on a listen call (if needed) so put some sane value here.
>>
>> Some sane is not good. For UDP sockets this is useless, for TCP you can request
>> for TCPINFO sockoption, it will contain the required value and (!) the socket
>> state, thus you won't have to mess with the SO_ACCEPTCONN above.
>>
> How about this update?
Almost perfect. Two comments:
> + if (sk->proto == IPPROTO_TCP) {
> + struct tcp_info info;
> +
> + aux = sizeof(info);
> + ret = getsockopt(lfd, SOL_TCP, TCP_INFO, &info, &aux);
> + if (ret) {
> + pr_perror("Failt to obtain TCP_INFO");
> + goto err;
> + }
> +
> + if (info.tcpi_state != TCP_CLOSE) {
> + pr_err("Socket state %d obtained but expected %d\n",
> + info.tcpi_state, TCP_CLOSE);
> + goto err;
> + }
> +
> + sk->wqlen = info.tcpi_backoff;
> + } else
> + sk->wqlen = 16; /* default value */
This is bad default value.
> + if (should_free_sk)
> + xfree(sk);
I'd push this socket into hash thus making the BUG_ON(sk->already_dumped) debug ON for them.
> Cyrill
More information about the CRIU
mailing list