• Chuck Lever's avatar
    SUNRPC: Deduplicate thread wake-up code · 850bac3a
    Chuck Lever authored
    Refactor: Extract the loop that finds an idle service thread from
    svc_xprt_enqueue() and svc_wake_up(). Both functions do just about
    the same thing.
    
    Note that svc_wake_up() currently does not hold the RCU read lock
    while waking the target thread. It indeed should hold the lock, just
    as svc_xprt_enqueue() does, to ensure the rqstp does not vanish
    during the wake-up. This patch adds the RCU lock for svc_wake_up().
    
    Note that shrinking the pool thread count is rare, and calls to
    svc_wake_up() are also quite infrequent. In practice, this race is
    very unlikely to be hit, so we are not marking the lock fix for
    stable backport at this time.
    Reviewed-by: default avatarJeff Layton <jlayton@redhat.com>
    Reviewed-by: default avatarNeilBrown <neilb@suse.de>
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    850bac3a
svc_xprt.c 38.3 KB