Simplify handling of credits in compound_send_recv()
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest2 patches 4 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | cifs: change wait_for_free_request to take number of requests to wait forfs/ fs/ fs/ | +17 | 4 replies | |
| 2/2 | cifs: simplify how we handle credits in compond_send_recv()fs/ | +13 | 0 replies |
Reviews trailers per patch
No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.
Cover letter [PATCH 0/2] Simplify handling of credits in compound_send_recv()
Pavel, Steve,
I think we can simplify the credits handling in compound_send_recv() a bit.
The first patch adds an extra argument to wait_for_free_request() and allows us to atomically wait for n (n >= 1) requests/credits instead of just a single one.
All callsites pass 1 as number of requests so no behaviour should be changed.
The second patch uses this new feature to now atomically wait for num_rqst requests/credits in one single call.
This makes the code much simpler, since we no longer need to return the credits if we only got a partial number of requests (can no longer happen). It also solves a potential deadlock if we have many concurrent threads trying to allocate requests/credits at the same time. I.e.
each one grabs one or two requests but then block on the final request.
We still have the issue that if we we do not have enough credits for the compound,
and the server will not grant us any additional credits in any responses yet to be received, and the client is not doing any other I/O which might bump the number of requests, then we might block indefinitely, or until the session is reconnected. That is unchanged but should be a lot rarer since we no longer have the deadlock between many concurrent threads.