[CRIU] [PATCH v6 7/9] unix: Add support of ghost sockets

Andrey Vagin avagin at virtuozzo.com
Tue May 22 23:07:28 MSK 2018


On Tue, May 22, 2018 at 10:00:46PM +0300, Cyrill Gorcunov wrote:
> On Tue, May 22, 2018 at 11:36:49AM -0700, Andrey Vagin wrote:
> > >  
> > >  #define USK_PAIR_MASTER		0x1
> > >  #define USK_PAIR_SLAVE		0x2
> > > +#define USK_GHOST_FDSTORE	0x4
> > 
> > pls add a comment what USK_GHOST_FDSTORE means
> 
> ok
> ...
> > > +	list_for_each_entry(ui, &unix_ghost_addr, ghost_node) {
> > > +		pr_debug("ghost: id %#x type %s state %s ino %d peer %d address %s\n",
> > > +			 ui->ue->id, socket_type_name(ui->ue->type),
> > > +			 tcp_state_name(ui->ue->state),
> > > +			 ui->ue->ino, ui->peer ? ui->peer->ue->ino : 0,
> > > +			 ui->name);
> > > +
> > > +		unlink_sk(ui);
> > > +
> > > +		/*
> > > +		 * Figure out who is connected to this peer,
> > > +		 * so the name will be removed from FS only
> > > +		 * when last one is connected.
> > 
> > 
> > is it an old comment?
> 
> yup, left from previous branches, will drop
> 
> > 
> > > +		 */
> > > +		list_for_each_entry(t, &unix_sockets, list) {
> > 
> > Why do we need this loop
> 
> For debug sake mostly, since it shows who is connected to us
> and if something goes wrong at least we can get more info
> from the log. If you still prefer I can drop it

Pls drop it. We have one more place where we initialize ui->peer and we
can show all required information there.

> 
> > > +			if (t->flags & USK_GHOST_FDSTORE)
> > > +				continue;
> > > +			if (ui == t || t->peer != ui)
> > > +				continue;
> > > +
> > > +			pr_debug("\t\tghost: id %#x type %s state %s connected to us %d -> %d\n",
> > > +				 t->ue->id, socket_type_name(t->ue->type),
> > > +				 tcp_state_name(t->ue->state),
> > > +				 t->ue->ino, ui->ue->ino);
> > > +		}
> > > +		ui->flags |= USK_GHOST_FDSTORE;


More information about the CRIU mailing list