[CRIU] Re: [RFC] inet unbound sockets restore
Pavel Emelyanov
xemul at parallels.com
Sat May 12 10:40:39 EDT 2012
On 05/12/2012 06:35 PM, Cyrill Gorcunov wrote:
> On Sat, May 12, 2012 at 06:30:02PM +0400, Pavel Emelyanov wrote:
>> On 05/12/2012 06:24 PM, Cyrill Gorcunov wrote:
>>> Pavel, take a look please, this patch brings ability to
>>> restore unbound inet sockets, thus test unbound_sockets
>>> become alive.
>>>
>>> (ps. not for merge, I'll send out the whole series later
>>> once you confirm if this patch looks good for you)
>>>
>>> Cyrill
>>
>>> @@ -264,7 +431,7 @@ static int open_inet_sk(struct file_desc *d)
>>> * bind() and listen(), and that's all.
>>> */
>>>
>>> - if (inet_bind(sk, ii))
>>> + if (ii->ie.state != TCP_CLOSE && inet_bind(sk, ii))
>>> goto err;
>>>
>>> if (ii->ie.state == TCP_LISTEN) {
>>
>> O_o
>
> Not really sure I follow, what do yo don't like here?
What is this check here for? I mean -- e.g. unbound UDP socket can be
connected. Here should go something like "if (is_bound(&ii->ie))" where
is_bound() checks for the name being non empty or smth like this.
>>> +static struct inet_sk_desc *gen_uncon_sk(int lfd, const struct fd_parms *p)
>>> +{
>>
>> From here till the relevant } comes some not yet brushed up code, thus I
>> haven't looked at it close enough.
>
> ok, i'll clean it up more.
>
>>
>>> +static unsigned int self_sk_inode(int lfd)
>>> +{
>>> + char path[64], buf[32], *tok;
>>> +
>>> + snprintf(path, sizeof(path), "/proc/self/fd/%d", lfd);
>>> + readlink(path, buf, sizeof(buf));
>>> +
>>> + tok = strtok(buf, "[");
>>> + tok = strtok(NULL, "]");
>>> + BUG_ON(!tok);
>>> +
>>> + return atoi(tok);
>>> +}
>>
>> It's MUCH simpler to call fstat for this.
>
> Ah, indeed. Thanks!
>
> Cyrill
> _______________________________________________
> CRIU mailing list
> CRIU at openvz.org
> https://openvz.org/mailman/listinfo/criu
> .
>
More information about the CRIU
mailing list