[PATCH 03/10] smb: client: compress: disable compression on reconnects
Enzo Matsumiya <[email protected]>
| Newsgroups | org.kernel.vger.linux-cifs |
|---|---|
| Message-ID | <[email protected]> |
Windows Server resets the connection if it gets a compressed request that it couldn't decompress. Some encoded payloads might decode differently on the server, or vice-versa, due to different implementation details (not really a bug), or an actual bug on either implementation. To prevent an infinite retry on such failed sends, simply disable compression for that server when a reconnect is about to happen. Signed-off-by: Enzo Matsumiya <[email protected]> --- fs/smb/client/connect.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/fs/smb/client/connect.c b/fs/smb/client/connect.c index 85aec302c89e..324452bc0437 100644 --- a/fs/smb/client/connect.c +++ b/fs/smb/client/connect.c @@ -401,6 +401,20 @@ static int __cifs_reconnect(struct TCP_Server_Info *server, try_to_freeze(); cifs_server_lock(server); + /* + * Servers might disconnect us when they can't decompress a compressed request we + * sent. + * When this happens, as a failsafe measure, disable compression entirely to avoid + * an endless retry. + * + * TODO: implement a more flexible alternative, e.g. identify and retry sending the + * failed request uncompressed, without having to disable compression entirely. + */ + if (server->compression.enabled) { + cifs_server_dbg(VFS | ONCE, "disabling compression (failsafe)\n"); + memset(&server->compression, 0, sizeof(server->compression)); + } + if (!cifs_swn_set_server_dstaddr(server) && !SERVER_IS_CHAN(server)) { /* resolve the hostname again to make sure that IP address is up-to-date */ -- 2.54.0