Re: [patch] AF_UNIX: notify peer on close

From: Julian Anastasov (uli@linux.tu-varna.acad.bg)
Date: Sat Mar 04 2000 - 16:22:18 EST


        Hello,

On Sat, 4 Mar 2000 kuznet@ms2.inr.ac.ru wrote:

> Hello!
>
> > May be sock_orphan(sk) must be after
> > wake_up_interruptible_all(&sk->protinfo.af_unix.peer_wait); ?
>
> No, it is not related to orphaned state, it wakes peers
> sleeping on us.

        Yep, right.

>
> > --- linux/net/unix/af_unix.c.orig Sat Mar 4 10:08:02 2000
> > +++ linux/net/unix/af_unix.c Sat Mar 4 18:53:41 2000
> > @@ -356,8 +356,10 @@
> > if (!skb_queue_empty(&sk->receive_queue) || embrion)
> > skpair->err = ECONNRESET;
> > unix_state_wunlock(skpair);
> > - sk->state_change(skpair);
> > - sock_wake_async(sk->socket,1,POLL_HUP);
> > + skpair->state_change(skpair);
> > + read_lock(&skpair->callback_lock);
> > + sock_wake_async(skpair->socket,0,POLL_HUP);
> > + read_lock(&skpair->callback_lock);
> > }
> > sock_put(skpair); /* It may now die */
> > unix_peer(sk) = NULL;
>
> I apologize, mipsrint, the second read_lock is read_unlock really.

        I made the same mistake. It seems that with this read_lock
the code works by mistake :)

>
> > I think, nobody uses si_band. si_code is enough (POLL_xxx).
>
> Grrr... What a crap, to be honest. Are these fields described
> in any standard? si_code is evident redundancy. Moreover, it
> is not only redundancy, it is deoptimization not allowing to
> merge events, when they can be merged by oring event masks.
>
> Alexey
>

Regards

--
Julian Anastasov <uli@linux.tu-varna.acad.bg>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Tue Mar 07 2000 - 21:00:17 EST