summaryrefslogtreecommitdiffstats
path: root/fs/cifs/transport.c
diff options
context:
space:
mode:
authorPavel Shilovsky <piastryyy@gmail.com>2019-03-04 14:02:50 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-03-23 20:09:56 +0100
commitdc8e8ad962a8add17737ec29396bb7a754907e52 (patch)
tree241ab90ab079fc3341f006e692a314704273585c /fs/cifs/transport.c
parent3ed9f22e28dd3a2b18f65ee5442882ebded6413e (diff)
downloadlinux-stable-dc8e8ad962a8add17737ec29396bb7a754907e52.tar.gz
linux-stable-dc8e8ad962a8add17737ec29396bb7a754907e52.tar.bz2
linux-stable-dc8e8ad962a8add17737ec29396bb7a754907e52.zip
CIFS: Do not skip SMB2 message IDs on send failures
commit c781af7e0c1fed9f1d0e0ec31b86f5b21a8dca17 upstream. When we hit failures during constructing MIDs or sending PDUs through the network, we end up not using message IDs assigned to the packet. The next SMB packet will skip those message IDs and continue with the next one. This behavior may lead to a server not granting us credits until we use the skipped IDs. Fix this by reverting the current ID to the original value if any errors occur before we push the packet through the network stack. This patch fixes the generic/310 test from the xfs-tests. Cc: <stable@vger.kernel.org> # 4.19.x Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/cifs/transport.c')
-rw-r--r--fs/cifs/transport.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index 66348b3d28e6..f2938bd95c40 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -638,6 +638,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
cifs_in_send_dec(server);
if (rc < 0) {
+ revert_current_mid(server, mid->credits);
server->sequence_number -= 2;
cifs_delete_mid(mid);
}
@@ -842,6 +843,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
for (i = 0; i < num_rqst; i++) {
midQ[i] = ses->server->ops->setup_request(ses, &rqst[i]);
if (IS_ERR(midQ[i])) {
+ revert_current_mid(ses->server, i);
for (j = 0; j < i; j++)
cifs_delete_mid(midQ[j]);
mutex_unlock(&ses->server->srv_mutex);
@@ -867,8 +869,10 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
for (i = 0; i < num_rqst; i++)
cifs_save_when_sent(midQ[i]);
- if (rc < 0)
+ if (rc < 0) {
+ revert_current_mid(ses->server, num_rqst);
ses->server->sequence_number -= 2;
+ }
mutex_unlock(&ses->server->srv_mutex);