[Devel] [PATCH rh7] ve, net: Fix unbalanced double spin_unlock() in tcp_v4_kill_ve_sockets()

Kirill Tkhai ktkhai at odin.com
Tue May 19 08:00:01 PDT 2015


В Вт, 19/05/2015 в 17:54 +0300, Vasily Averin пишет:
> 1) how about rh6?

Already sent.

> 2) how about spin_unlock(lock) ?

		spin_lock(lock);					<--- LOCK
                sk_nulls_for_each(sk, node, &head[i].chain) {
                        if (sock_net(sk)->owner_ve == envid) {
                                sock_hold(sk);
                                spin_unlock(lock);			<--- UNLOCK

                                bh_lock_sock(sk);
                                if (sock_owned_by_user(sk)) {
                                        retry = 1;
                                        bh_unlock_sock(sk);
                                        sock_put(sk);
                                        goto enable_bh;

> On 19.05.2015 17:43, Kirill Tkhai wrote:
> > Double loop is here, "break works is not as expected".
> > 
> > Signed-off-by: Kirill Tkhai <ktkhai at odin.com>
> > ---
> >  net/ipv4/tcp_ipv4.c |    3 ++-
> >  1 file changed, 2 insertions(+), 1 deletion(-)
> > 
> > diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
> > index 532edea..0e990c2 100644
> > --- a/net/ipv4/tcp_ipv4.c
> > +++ b/net/ipv4/tcp_ipv4.c
> > @@ -2880,7 +2880,7 @@ void tcp_v4_kill_ve_sockets(struct ve_struct *envid)
> >  					retry = 1;
> >  					bh_unlock_sock(sk);
> >  					sock_put(sk);
> > -					break;
> > +					goto enable_bh;
> >  				}
> >  				/* sk might have disappeared from the hash before
> >  				 * we got the lock */
> > @@ -2893,6 +2893,7 @@ void tcp_v4_kill_ve_sockets(struct ve_struct *envid)
> >  		}
> >  		spin_unlock(lock);
> >  	}
> > +enable_bh:
> >  	local_bh_enable();
> >  	if (retry) {
> >  		schedule_timeout_interruptible(HZ);
> > 
> > _______________________________________________
> > Devel mailing list
> > Devel at openvz.org
> > https://lists.openvz.org/mailman/listinfo/devel
> > 





More information about the Devel mailing list