• NeilBrown's avatar
    SUNRPC: make rqst_should_sleep() idempotent() · 6859d1f2
    NeilBrown authored
    Based on its name you would think that rqst_should_sleep() would be
    read-only, not changing anything.  But in fact it will clear
    SP_TASK_PENDING if that was set.  This is surprising, and it blurs the
    line between "check for work to do" and "dequeue work to do".
    
    So change the "test_and_clear" to simple "test" and clear the bit once
    the thread has decided to wake up and return to the caller.
    
    With this, it makes sense to *always* set SP_TASK_PENDING when asked,
    rather than to set it only if no thread could be woken up.
    
    [ cel: Previously TASK_PENDING indicated there is work waiting but no
    idle threads were found to pick up that work. After this patch, it acts
    as an XPT_BUSY flag for wake-ups that have no associated xprt. ]
    Signed-off-by: default avatarNeilBrown <neilb@suse.de>
    Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    6859d1f2
svc_xprt.c 38.4 KB