• Y
    tipc: standardize connect routine · 78eb3a53
    Ying Xue 提交于
    Comparing the behaviour of how to wait for events in TIPC connect()
    with other stacks, the TIPC implementation might be perceived as
    different, and sometimes even incorrect. For instance, as both
    sock->state and sk_sleep() are directly fed to
    wait_event_interruptible_timeout() as its arguments, and socket lock
    has to be released before we call wait_event_interruptible_timeout(),
    the two variables associated with socket are exposed out of socket
    lock protection, thereby probably getting stale values so that the
    process of calling connect() cannot be woken up exactly even if
    correct event arrives or it is woken up improperly even if the wake
    condition is not satisfied in practice. Therefore, standardizing its
    behaviour with sk_stream_wait_connect routine can avoid these risks.
    
    Additionally the implementation of connect routine is simplified as a
    whole, allowing it to return correct values in all different cases.
    Signed-off-by: NYing Xue <ying.xue@windriver.com>
    Reviewed-by: NJon Maloy <jon.maloy@ericsson.com>
    Signed-off-by: NDavid S. Miller <davem@davemloft.net>
    78eb3a53
socket.c 49.3 KB