linux-yocto/fs/smb/common
Wang Zhaolong 209a4da04a smb: client: Store original IO parameters and prevent zero IO sizes
[ Upstream commit 287906b200 ]

During mount option processing and negotiation with the server, the
original user-specified rsize/wsize values were being modified directly.
This makes it impossible to recover these values after a connection
reset, leading to potential degraded performance after reconnection.

The other problem is that When negotiating read and write sizes, there are
cases where the negotiated values might calculate to zero, especially
during reconnection when server->max_read or server->max_write might be
reset. In general, these values come from the negotiation response.
According to MS-SMB2 specification, these values should be at least 65536
bytes.

This patch improves IO parameter handling:

1. Adds vol_rsize and vol_wsize fields to store the original user-specified
   values separately from the negotiated values
2. Uses got_rsize/got_wsize flags to determine if values were
   user-specified rather than checking for non-zero values, which is more
   reliable
3. Adds a prevent_zero_iosize() helper function to ensure IO sizes are
   never negotiated down to zero, which could happen in edge cases like
   when server->max_read/write is zero

The changes make the CIFS client more resilient to unusual server
responses and reconnection scenarios, preventing potential failures
when IO sizes are calculated to be zero.

Signed-off-by: Wang Zhaolong <wangzhaolong1@huawei.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-06-04 14:41:54 +02:00
..
arc4.h
cifs_arc4.c
cifs_md4.c
Makefile
md4.h
smb2pdu.h smb: client: Store original IO parameters and prevent zero IO sizes 2025-06-04 14:41:54 +02:00
smbfsctl.h cifs: Treat unhandled directory name surrogate reparse points as mount directory nodes 2025-03-22 12:50:43 -07:00