smb3: do not reserve too many oplock credits
authorSteve French <stfrench@microsoft.com>
Tue, 20 Jun 2023 03:32:38 +0000 (22:32 -0500)
committerSteve French <stfrench@microsoft.com>
Wed, 21 Jun 2023 04:03:03 +0000 (23:03 -0500)
commite8eeca0bf4466ee1b196346d3a247535990cf44d
treeb7b5358e1466a0dd3cfb3a0b5f8668dfabf39027
parentacf35d79ee8c1cce0f879efe6446cf81e5491c36
smb3: do not reserve too many oplock credits

There were cases reported where servers will sometimes return more
credits than requested on oplock break responses, which can lead to
most of the credits being allocated for oplock breaks (instead of
for normal operations like read and write) if number of SMB3 requests
in flight always stays above 0 (the oplock and echo credits are
rebalanced when in flight requests goes down to zero).

If oplock credits gets unexpectedly large (e.g. three is more than it
would ever be expected to be) and in flight requests are greater than
zero, then rebalance the oplock credits and regular credits (go
back to reserving just one oplock credit).

Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/smb2ops.c