mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
xprtrdma: Repost Receive buffers for malformed replies
rpcrdma_wc_receive() decrements the transport's Receive count for every completion before it dispatches a successful Receive to rpcrdma_reply_handler(). The handler must post a replacement Receive WR before returning unless ownership of the rep has moved elsewhere, as on the backchannel path. Commit2ae50ad68c("xprtrdma: Close window between waking RPC senders and posting Receives") moved the Receive refill out of rpcrdma_wc_receive(), where it had run ahead of every reply, into rpcrdma_reply_handler() so that the responder's credit grant could be parsed before reposting. The bad-version and short-reply exits never reach that refill: they recycle the rep and return without calling rpcrdma_post_recvs(). A remote peer can therefore drain the client's posted Receive queue by sending a sustained stream of replies that are shorter than the fixed transport header or that carry an unrecognized RPC/RDMA version. Each such reply consumes one posted Receive without replacing it. Once the queue empties, the peer's next Send finds no posted Receive and the transport stalls until reconnect. Route both malformed-reply exits through the shared repost tail after recycling the rep, refilling against buf->rb_credits, the most recent accepted credit grant. Neither exit updates the congestion window, so RPCs admitted under the previous grant remain in flight awaiting replies. A smaller refill target would let a stream of malformed replies ratchet the posted Receive count down to the batch floor while the congestion window still admits rb_credits RPCs; a burst of valid replies to those RPCs could then overrun the posted Receives, and because the client connects with rnr_retry_count of zero, a single RNR NAK terminates the connection. Refilling against rb_credits also restores the target that applied to malformed replies before commit2ae50ad68c("xprtrdma: Close window between waking RPC senders and posting Receives") when rpcrdma_post_recvs() computed it from rb_credits internally. rb_credits is at least one from connection establishment onward, so the repost path always keeps Receives posted. Fixes:2ae50ad68c("xprtrdma: Close window between waking RPC senders and posting Receives") Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Anna Schumaker <anna.schumaker@hammerspace.com>
This commit is contained in:
parent
c3a628aab2
commit
abc011ddaf
|
|
@ -1528,11 +1528,13 @@ void rpcrdma_reply_handler(struct rpcrdma_rep *rep)
|
|||
|
||||
out_badversion:
|
||||
trace_xprtrdma_reply_vers_err(rep);
|
||||
goto out;
|
||||
rpcrdma_rep_put(buf, rep);
|
||||
credits = buf->rb_credits;
|
||||
goto out_post;
|
||||
|
||||
out_shortreply:
|
||||
trace_xprtrdma_reply_short_err(rep);
|
||||
|
||||
out:
|
||||
rpcrdma_rep_put(buf, rep);
|
||||
credits = buf->rb_credits;
|
||||
goto out_post;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user