[CRIU] [PATCH 2/2] tcp: refresh a data about tcp connection after blocking it (v4)

Andrew Vagin avagin at parallels.com
Fri Nov 16 06:41:55 EST 2012


On Fri, Nov 16, 2012 at 03:02:22PM +0400, Pavel Emelyanov wrote:
> >  static int tcp_repair_establised(int fd, struct inet_sk_desc *sk)
> >  {
> >  	int ret;
> > @@ -298,6 +330,21 @@ int dump_one_tcp(int fd, struct inet_sk_desc *sk)
> >  		ret = nf_lock_connection(sk);
> >  		if (ret < 0)
> >  			return -1;
> > +
> > +		/* A state of a tcp connection could be changed */
> > +		ret = refresh_inet_sk(fd, sk);
> > +		if (ret < 0)
> > +			goto err;
> > +
> > +		if (sk->state == TCP_CLOSE) {
> 
> Socket cant change state from established to closed w/o task's will.

Look at tcp_done(sk). It's called from tcp_keepalive_timer,
tcp_write_timeout, etc.
> 
> > +			nf_unlock_connection(sk);
> > +			return 0;
> > +		}
> > +
> > +		if (sk->state != TCP_ESTABLISHED) {
> > +			pr_err("Unknown state %d\n", sk->state);
> > +			goto err;
> > +		}
> >  	}
> >  
> >  	pr_info("Dumping TCP connection\n");
> > 
> 
> 


More information about the CRIU mailing list