All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] CIFS: Wait for credits if at least one request is in flight
@ 2021-02-02  1:01 Pavel Shilovsky
  2021-02-02  3:39 ` Tom Talpey
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Shilovsky @ 2021-02-02  1:01 UTC (permalink / raw)
  To: Steve French, Shyam Prasad N, Ronnie Sahlberg, linux-cifs; +Cc: Pavel Shilovsky

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: <stable@vger.kernel.org> # 5.1+
Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
---
 fs/cifs/transport.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 4ffbf8f965814..84f33fdd1f4e0 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -659,10 +659,10 @@ wait_for_compound_request(struct TCP_Server_Info *server, int num,
 	spin_lock(&server->req_lock);
 	if (*credits < num) {
 		/*
-		 * Return immediately if not too many requests in flight since
-		 * we will likely be stuck on waiting for credits.
+		 * Return immediately if no requests in flight since
+		 * we will be stuck on waiting for credits.
 		 */
-		if (server->in_flight < num - *credits) {
+		if (server->in_flight == 0) {
 			spin_unlock(&server->req_lock);
 			return -ENOTSUPP;
 		}
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-02-02 19:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-02  1:01 [PATCH] CIFS: Wait for credits if at least one request is in flight Pavel Shilovsky
2021-02-02  3:39 ` Tom Talpey
2021-02-02 18:17   ` Pavel Shilovsky
2021-02-02 19:05     ` Tom Talpey
2021-02-02 19:45       ` Pavel Shilovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.