]> www.infradead.org Git - users/jedix/linux-maple.git/commit
ksmbd: fix broken transfers when exceeding max simultaneous operations
authorMarios Makassikis <mmakassikis@freebox.fr>
Sat, 14 Dec 2024 03:17:23 +0000 (12:17 +0900)
committerSteve French <stfrench@microsoft.com>
Mon, 16 Dec 2024 04:20:03 +0000 (22:20 -0600)
commit43fb7bce8866e793275c4f9f25af6a37745f3416
tree906cf759ba4d4b63de28b7b0bd0ea0f7b0b2bee2
parent83c47d9e0ce79b5d7c0b21b9f35402dbde0fa15c
ksmbd: fix broken transfers when exceeding max simultaneous operations

Since commit 0a77d947f599 ("ksmbd: check outstanding simultaneous SMB
operations"), ksmbd enforces a maximum number of simultaneous operations
for a connection. The problem is that reaching the limit causes ksmbd to
close the socket, and the client has no indication that it should have
slowed down.

This behaviour can be reproduced by setting "smb2 max credits = 128" (or
lower), and transferring a large file (25GB).

smbclient fails as below:

  $ smbclient //192.168.1.254/testshare -U user%pass
  smb: \> put file.bin
  cli_push returned NT_STATUS_USER_SESSION_DELETED
  putting file file.bin as \file.bin smb2cli_req_compound_submit:
  Insufficient credits. 0 available, 1 needed
  NT_STATUS_INTERNAL_ERROR closing remote file \file.bin
  smb: \> smb2cli_req_compound_submit: Insufficient credits. 0 available,
  1 needed

Windows clients fail with 0x8007003b (with smaller files even).

Fix this by delaying reading from the socket until there's room to
allocate a request. This effectively applies backpressure on the client,
so the transfer completes, albeit at a slower rate.

Fixes: 0a77d947f599 ("ksmbd: check outstanding simultaneous SMB operations")
Signed-off-by: Marios Makassikis <mmakassikis@freebox.fr>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/server/connection.c
fs/smb/server/connection.h
fs/smb/server/server.c
fs/smb/server/server.h
fs/smb/server/transport_ipc.c