CIFS: Fix credit computation for compounded requests
authorPavel Shilovsky <pshilov@microsoft.com>
Sat, 22 Dec 2018 20:40:05 +0000 (12:40 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 16 Jan 2019 21:04:31 +0000 (22:04 +0100)
commit7dcc5b36ea7f5f5d15907e439befa14cecffc9f1
treeca2f0283590fbcd3a6ab8cf3ec913cc3a4ff5c40
parentd2f76f6f9fa963d337e72616f6e06b8bbac5eb7f
CIFS: Fix credit computation for compounded requests

commit 8544f4aa9dd19a04d1244dae10feecc813ccf175 upstream.

In SMB3 protocol every part of the compound chain consumes credits
individually, so we need to call wait_for_free_credits() for each
of the PDUs in the chain. If an operation is interrupted, we must
ensure we return all credits taken from the server structure back.

Without this patch server can sometimes disconnect the session
due to credit mismatches, especially when first operation(s)
are large writes.

Signed-off-by: Pavel Shilovsky <pshilov@microsoft.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
CC: Stable <stable@vger.kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/cifs/transport.c