[Patch v2 2/4] veth: implement io_alloc()

Thomas Graf tgraf at suug.ch
Tue Apr 1 18:24:39 EDT 2014


On 04/01/14 at 11:03am, Cong Wang wrote:
> On Tue, Apr 1, 2014 at 4:54 AM, Thomas Graf <tgraf at suug.ch> wrote:
> >
> > The case that I wanted to have covered is:
> >
> > 1. create veth X
> > 2. peer Y gets created automatically
> 
> refcount of X and Y is 1.
> 
> > 3. acquire new ref on Y and push it into a cache or something
> 
> refcount of Y becomes to 2.
> 
> > 4. original user releases ref on X
> 
> refcount of X will be 0, so it will be freed.
> 
> > 5. at this point X will get freed if Y doesn't hold a ref
> 
> Yeaj, Bbut why Y would be freed since its refcount is still 1 after we put it
> in veth_free()?

Agreed but I would expect X to stay around as well unless
Y is released. I was under the impression that veth would
always come in pairs ;-)



More information about the libnl mailing list