[CRIU] Re: [RFC] inet unbound sockets restore

Cyrill Gorcunov gorcunov at openvz.org
Sat May 12 10:35:56 EDT 2012


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?

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


More information about the CRIU mailing list