• J. Bruce Fields's avatar
    svcrpc: fix svc_xprt_enqueue/svc_recv busy-looping · d10f27a7
    J. Bruce Fields authored
    The rpc server tries to ensure that there will be room to send a reply
    before it receives a request.
    
    It does this by tracking, in xpt_reserved, an upper bound on the total
    size of the replies that is has already committed to for the socket.
    
    Currently it is adding in the estimate for a new reply *before* it
    checks whether there is space available.  If it finds that there is not
    space, it then subtracts the estimate back out.
    
    This may lead the subsequent svc_xprt_enqueue to decide that there is
    space after all.
    
    The results is a svc_recv() that will repeatedly return -EAGAIN, causing
    server threads to loop without doing any actual work.
    
    Cc: stable@vger.kernel.org
    Reported-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
    Tested-by: default avatarMichael Tokarev <mjt@tls.msk.ru>
    Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
    d10f27a7
svc_xprt.c 33.7 KB