Skip to content

Commit 553e969

Browse files
sprasad-microsoftgregkh
authored andcommitted
cifs: change_conf needs to be called for session setup
commit c208a2b upstream. Today we skip calling change_conf for negotiates and session setup requests. This can be a problem for mchan as the immediate next call after session setup could be due to an I/O that is made on the mount point. For single channel, this is not a problem as there will be several calls after setting up session. This change enforces calling change_conf when the total credits contain enough for reservations for echoes and oplocks. We expect this to happen during the last session setup response. This way, echoes and oplocks are not disabled before the first request to the server. So if that first request is an open, it does not need to disable requesting leases. Cc: <stable@vger.kernel.org> Reviewed-by: Bharath SM <bharathsm@microsoft.com> Signed-off-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent b71b48a commit 553e969

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

fs/smb/client/smb2ops.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,10 +111,21 @@ smb2_add_credits(struct TCP_Server_Info *server,
111111
cifs_trace_rw_credits_zero_in_flight);
112112
}
113113
server->in_flight--;
114+
115+
/*
116+
* Rebalance credits when an op drains in_flight. For session setup,
117+
* do this only when the total accumulated credits are high enough (>2)
118+
* so that a newly established secondary channel can reserve credits for
119+
* echoes and oplocks. We expect this to happen at the end of the final
120+
* session setup response.
121+
*/
114122
if (server->in_flight == 0 &&
115123
((optype & CIFS_OP_MASK) != CIFS_NEG_OP) &&
116124
((optype & CIFS_OP_MASK) != CIFS_SESS_OP))
117125
rc = change_conf(server);
126+
else if (server->in_flight == 0 &&
127+
((optype & CIFS_OP_MASK) == CIFS_SESS_OP) && *val > 2)
128+
rc = change_conf(server);
118129
/*
119130
* Sometimes server returns 0 credits on oplock break ack - we need to
120131
* rebalance credits in this case.

0 commit comments

Comments
 (0)