[Drbd-dev] Avoid nested sleeping on TCP connect

Lars Ellenberg lars.ellenberg at linbit.com
Wed Feb 22 09:18:42 CET 2017

On Mon, Feb 20, 2017 at 05:58:16PM +0100, Andreas Osterburg wrote:
> Thanks for your investigations.
> I didn't use a loop since the old behaviour was to leave the function returning -EAGAIN
> on timeout or interrupt. There is just one difference: When an event from the socket occures
> and no TCP-connection is established, the function leaves before the timeout elapses.

There may well be several incoming TCP connections,
and we want to wait for the right one.

> It makes no real difference to an interrupt, so I didn't handle it
> specially.

Usually there is no interrupt.
Interrupt would mean someone cancels the connection attemt,
tears down the connection before it is even established.
So yes, it could make a significant difference in some setups.

Anyways: right now, best to just leave it alone.
The inner mutex is supposed to have no real contention, the worst thing
that would happen if we should have to block for it, and the condition
is still not met, is one extra iteration in the outer wait_event loop,
which is harmless.

: Lars Ellenberg
: LINBIT | Keeping the Digital World Running
: DRBD -- Heartbeat -- Corosync -- Pacemaker
: R&D, Integration, Ops, Consulting, Support

DRBD® and LINBIT® are registered trademarks of LINBIT

More information about the drbd-dev mailing list