[Samba] Mount.cifs option "directio" versus smb option "Oplocks = No"

Andy Liebman andyliebman at aol.com
Tue May 27 01:33:19 GMT 2008


I have a situation where under some circumstances it is advantageous for 
Samba Shares to have "Oplocks = Yes" (the Samba default) whereas in 
other circumstances it is disadvantageous.

For instance, with Oplocks enabled, when I mount a share on a Linux box 
with "mount -t cifs", when an application writes to the share, I 
typically see long delays from the time a file starts getting written by 
the application and the time data actually starts traveling across the 
network. With Oplocks enabled, it seems that data is cached in local RAM 
until the RAM gets too full, and then there is a rush to transfer the 
data to its intended destination.
 
I can counteract this behavior on Linux by mounting the share with the 
option "mount -t cifs -o,directio".  Reading the man pages for 
mount.cifs, it seems that the "directio" option causes the Linux samba 
client to bypass any caching in local RAM either for reads or writes.

Can someone explain to me what the interaction is between these two 
settings -- Oplocks on the Samba Server and "directio" on a Linux 
client? Will "directio" completely disable the effect of Oplocks on the 
Linux client?

Andy




More information about the samba mailing list