A bug that causes file to get corrupted when using cp. When I mount another server and copy file, the copy command completes successfully, but the file is corrupted. This occurs when a reconnection request is received from a client and the server child process is changed. I think that writing does not work correctly when the server-side child process is switched due to a reconnect while copying a file. This occurs due to timing issues with reconnection, is there a way to avoid this file corruption? Environment: OS:ubuntu24.04, Redhat8.10 SMB:4.22.2
There are some other conditions under which this can happen: If there are two mounts between the client and the server, and one of them sends a RST to the server, it will break the connection and may affect the write process of the other mount.
The number of mounts didn't matter. Please forget the last post. The problem lies in the interface between CIFS and VFS. Normally there is only one cifs_witepages() process for cp command, but when page_cache needs to be consumed, cifs_witepages() is called as a kernel_events. This increases cifs_writepages() and speeds up page_cache writebacks. However, there is a problem with cifs_writepages(), which is executed by a kernel events. If an RST occurs during execution and the connection is lost, the page will no longer be able to be written because it has lost its file descriptor. And This part is broken. I don't have any good ideas. If cifs_writepages() on the kernel event side determines that writing is not possible, an error should be returned to cifs_writepages() on the cp side, but I don't know if that's possible. The only information shared between the two is the page index.
Reassigning to Steve and cifs qa contact