Skip to content

Commit 91792bb

Browse files
piastrySteve French
authored andcommitted
smb3: fix crediting for compounding when only one request in flight
Currently we try to guess if a compound request is going to succeed waiting for credits or not based on the number of requests in flight. This approach doesn't work correctly all the time because there may be only one request in flight which is going to bring multiple credits satisfying the compound request. Change the behavior to fail a request only if there are no requests in flight at all and proceed waiting for credits otherwise. Cc: <[email protected]> # 5.1+ Signed-off-by: Pavel Shilovsky <[email protected]> Reviewed-by: Tom Talpey <[email protected]> Reviewed-by: Shyam Prasad N <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 8d8d1db commit 91792bb

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

fs/cifs/transport.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,10 +666,22 @@ wait_for_compound_request(struct TCP_Server_Info *server, int num,
666666

667667
if (*credits < num) {
668668
/*
669-
* Return immediately if not too many requests in flight since
670-
* we will likely be stuck on waiting for credits.
669+
* If the server is tight on resources or just gives us less
670+
* credits for other reasons (e.g. requests are coming out of
671+
* order and the server delays granting more credits until it
672+
* processes a missing mid) and we exhausted most available
673+
* credits there may be situations when we try to send
674+
* a compound request but we don't have enough credits. At this
675+
* point the client needs to decide if it should wait for
676+
* additional credits or fail the request. If at least one
677+
* request is in flight there is a high probability that the
678+
* server will return enough credits to satisfy this compound
679+
* request.
680+
*
681+
* Return immediately if no requests in flight since we will be
682+
* stuck on waiting for credits.
671683
*/
672-
if (server->in_flight < num - *credits) {
684+
if (server->in_flight == 0) {
673685
spin_unlock(&server->req_lock);
674686
trace_smb3_insufficient_credits(server->CurrentMid,
675687
server->hostname, scredits, sin_flight);

0 commit comments

Comments
 (0)