Re: [patch] AF_UNIX: notify peer on close

From: kuznet@ms2.inr.ac.ru
Date: Sat Mar 04 2000 - 11:03:45 EST


Hello!

Oops!

> - sock_orphan() must be called after notification, i.e. don't
> reset sk->sleep before notification

No-no-no! I simply messed sk and skpair both there and in unix_shutdown
(fixed recently). Leave sock_orphan on its place, it orphans sk, not skpair.

> AF_UNIX rt events now work for me. Is this patch
> correct ?

Alas, not quite.

- sock_orphan(sk);

It was OK.

- sk->state_change(skpair);

Julian, I have already told you that sk->state_change cannot
be replaced with data_ready, it is true for error_report() as well.
Please, look at the function sock_def_wakeup() and compare it to another ones.
See?

Mama... I did even worse thing. Locking is broken! Bad, bad, bad.
sock_wake_async() was called without callback_lock.
And unix_shutdown is broken too...

Seems, this combination is correct.

        skpair->state_change(skpair);
        read_lock(&skpair->callback_lock);
        sock_wake_async(skpair->socket,0,POLL_HUP);
        read_lock(&skpair->callback_lock);

Note, that POLL_HUP translates to POLLHUP|POLLERR in any case.
(which looks very silly, we could write simply POLLHUP|POLLERR 8)8)
 I have no idea, why it is indirected via band_table).

Alexey

-
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:16 EST