[Samba] Linux vs. Windows SMB buffering

Will Lucas mevatron at gmail.com
Fri Oct 13 18:45:54 UTC 2017


> So it's now getting a RWH lease, but still doing the raw
> syscall reads across the wire.
>
> Does it do the same to a Windows server ? Looks like the
> client application is deliberately turning off any
> redirector caching by using FILE_FLAG_WRITE_THROUGH on
> the CreateFile() Win32 call. If you can do the equivalent
> of strace on Windows (I don't know how) you might be
> able to confirm that and ask the app developer to stop
> doing that.
>
>
https://msdn.microsoft.com/en-us/library/windows/desktop/aa363858(v=vs.85).aspx
>
>
> FILE_FLAG_WRITE_THROUGH
> 0x80000000
>
>
>
> Write operations will not go through any intermediate cache, they will go
directly to disk.
>
> For additional information, see the Caching Behavior section of this
topic.

Jeremy,

It turns out the program was definitely flushing the stream after every
write (I verified this was the case with ProcMon), but I couldn't figure
out why (as I wasn't specifying the flush explicitly). I also tried NFS on
Windows and it behaved exactly the same way. I was completely stumped until
someone pointed out that endl flushes the stream implicitly.

Now SMB is buffering properly! Your help was definitely instrumental in me
finding the ultimate cause, so thank you very much!

Will


More information about the samba mailing list