CIFS: Do not skip SMB2 message IDs on send failures
authorPavel Shilovsky <piastryyy@gmail.com>
Mon, 4 Mar 2019 22:02:50 +0000 (14:02 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Mar 2019 19:09:56 +0000 (20:09 +0100)
commitdc8e8ad962a8add17737ec29396bb7a754907e52
tree241ab90ab079fc3341f006e692a314704273585c
parent3ed9f22e28dd3a2b18f65ee5442882ebded6413e
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>
fs/cifs/cifsglob.h
fs/cifs/smb2ops.c
fs/cifs/smb2transport.c
fs/cifs/transport.c