Description of problem: the cifs client code in the kernel sometimes garbles files that are written in append mode. Version-Release number of selected component (if applicable): kernel 2.6.18-164.15.1.el5 How reproducible: This depends on the write mode and probably on the type of SAMBA/CIFS server. Solution: I am pretty sure that the problem that we experience is what is described in kernel ChangeLog-2.31.7: http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.31.7 ---> Quoting: CIFS: Duplicate data on appending to some Samba servers commit cea62343956c24452700c06cf028b72414c58a74 upstream. SMB writes are sent with a starting offset and length. When the server supports the newer SMB trans2 posix open (rather than using the SMB NTCreateX) a file can be opened with SMB_O_APPEND flag, and for that case Samba server assumes that the offset sent in SMBWriteX is unneeded since the write should go to the end of the file - which can cause problems if the write was cached (since the beginning part of a page could be written twice by the client mm). Jeff suggested that masking the flag on posix open on the client is easiest for the time being. ----> End quote The fix is simple: comment out or remove lines 170 and 171 of fs/cifs/dir.c: if (oflags & O_APPEND) posix_flags != O_SMB_APPEND The line above is indeed not present in kernel 2.6.31.7. I recompiled the cifs kernel module and tested and for me this works.
Already fixed in 5.5. *** This bug has been marked as a duplicate of bug 500838 ***