[Samba] Setting Samba Write Cache Size Can Cause File Corruption

Jeremy Allison jra at samba.org
Tue Sep 28 16:04:50 MDT 2010

On Tue, Sep 28, 2010 at 05:34:37PM -0400, Andy Liebman wrote:

> I can tell you that setting write cache size to 131072 (half the
> size) makes the corruption go away, and so does turning off the
> "write cache size" setting altogether.  However, we are now
> wondering why the "write cache size" can have this effect on file
> corruption and whether setting it to 131072 will cause a corruption
> problem under some other circumstance we just haven't hit yet.

Well it's because this code must have a bug :-). Volker is
right, you should check it first with the v3-6-test git tree
code, as he has done some changes there that might have
already fixed it (if so we will back-port to 3.5.next of
course). If not, we'll need voluminous traces to track
down the exact set of writes that cause the problem.
Using the vfs_full_audit might initially help.

> Any ideas?  By the way, we have seen and documented this problem
> with both Samba 3.4.2 and Samba 3.5.3. We also noticed that "write
> cache size" was listed as "deprecated" in 3.4.2 and that in 3.5.3 it
> is no longer listed as "deprecated".  Somebody besides us must have
> thought keeping "write cache size" was still a good idea??

I wrote the original "write cache" code but thought
it wasn't needed (so marked it deprecated) but as
Volker found, sometimes it's really useful in certain


More information about the samba mailing list