• Sean Hefty's avatar
    RDMA/ucma: Discard all events for new connections until accepted · 9ced69ca
    Sean Hefty authored
    After reporting a new connection request to user space, the rdma_ucm
    will discard subsequent events until the user has associated a user
    space idenfier with the kernel cm_id.  This is needed to avoid
    reporting a reject/disconnect event to the user for a request that
    they may not have processed.
    
    The user space identifier is set once the user tries to accept the
    connection request.  However, the following race exists in ucma_accept():
    
    	ctx->uid = cmd.uid;
    	<events may be reported now>
    	ret = rdma_accept(ctx->cm_id, ...);
    
    Once ctx->uid has been set, new events may be reported to the user.
    While the above mentioned race is avoided, there is an issue that the
    user _may_ receive a reject/disconnect event if rdma_accept() fails,
    depending on when the event is processed.  To simplify the use of
    rdma_accept(), discard all events unless rdma_accept() succeeds.
    
    This problem was discovered based on questions from Roland Dreier
    <roland@purestorage.com>.
    Signed-off-by: default avatarSean Hefty <sean.hefty@intel.com>
    Signed-off-by: default avatarRoland Dreier <roland@purestorage.com>
    9ced69ca
ucma.c 32.2 KB