• Chuck Lever's avatar
    SUNRPC: Proper metric accounting when RPC is not transmitted · ae09531d
    Chuck Lever authored
    I noticed recently that during an xfstests on a krb5i mount, the
    retransmit count for certain operations had gone negative, and the
    backlog value became unreasonably large. I recall that Andy has
    pointed this out to me in the past.
    
    When call_refresh fails to find a valid credential for an RPC, the
    RPC exits immediately without sending anything on the wire. This
    leaves rq_ntrans, rq_xtime, and rq_rtt set to zero.
    
    The solution for om_queue is to not add the to RPC's running backlog
    queue total whenever rq_xtime is zero.
    
    For om_ntrans, it's a bit more difficult. A zero rq_ntrans causes
    om_ops to become larger than om_ntrans. The design of the RPC
    metrics API assumes that ntrans will always be equal to or larger
    than the ops count. The result is that when an RPC fails to find
    credentials, the RPC operation's reported retransmit count, which is
    computed in user space as the difference between ops and ntrans,
    goes negative.
    
    Ideally the kernel API should report a separate retransmit and
    "exited before initial transmission" metric, so that user space can
    sort out the difference properly.
    
    To avoid kernel API changes and changes to the way rq_ntrans is used
    when performing transport locking, account for untransmitted RPCs
    so that om_ntrans keeps up with om_ops: always add one or more to
    om_ntrans.
    Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
    Signed-off-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
    ae09531d
stats.c 7.57 KB