Skip to content

Commit e8eeca0

Browse files
committed
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 <[email protected]>
1 parent acf35d7 commit e8eeca0

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

fs/smb/client/smb2ops.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,11 @@ smb2_add_credits(struct TCP_Server_Info *server,
109109
server->credits--;
110110
server->oplock_credits++;
111111
}
112-
}
112+
} else if ((server->in_flight > 0) && (server->oplock_credits > 3) &&
113+
((optype & CIFS_OP_MASK) == CIFS_OBREAK_OP))
114+
/* if now have too many oplock credits, rebalance so don't starve normal ops */
115+
change_conf(server);
116+
113117
scredits = *val;
114118
in_flight = server->in_flight;
115119
spin_unlock(&server->req_lock);

0 commit comments

Comments
 (0)