On Mon, Aug 31, 2015 at 10:51:02PM +0300, Cyrill Gorcunov wrote:
> On Mon, Aug 31, 2015 at 10:36:25PM +0300, Vladimir Davydov wrote:
> > 
> > Yeah, you're right. But then we diverge from pty ref counting design,
> > which isn't good IMO. To fix that, let's increment slave's count twice
> > on vtty_install, once for file and once for master reference. Then we
> 
> If we increment it twice we have to carry extra-ref bit (which I've
> dropped off) otherwise if noone has opened master peer the tty engine
> will complain that the number of fd != count. What's worse is that
> if noone ever has opened master we have to decrement it back together
> with extra ref to be able to close the peer. I mean
> 
> 1) Create pair inside container via slave
> 
>       slave:2 (1 - read fd + extra ref)       master:0
> 
> noone opens master and we're calling tty_release, then in
> vtty_close we've tp drop the extra ref together with count--,
> but if we do so there is still a race window after tty_unlock.

I see. Then it's OK.

> 
> > will only have to decrement slave's count right after tty_init_dev,
> > which is safe, because we're holding tty_lock there. Sounds OK?
> 
_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to