[Samba] extra readdir operation when writing to a non-existent file
Zhang Bingjun (Eddy)
eddymier at gmail.com
Wed May 12 03:35:15 MDT 2010
Your suggestion works. Thank you very much!
Zhang Bingjun, Eddy
On Wed, May 12, 2010 at 4:33 PM, Alain Knaff <alain at knaff.lu> wrote:
> On 12/05/10 10:16, Zhang Bingjun (Eddy) wrote:
> > hi samba fellows,
> > It is my first time to ask questions in samba mail list. Very sorry if
> > my question is very naive.
> > The problem is when I write to
> > a non-existent file from windows to a linux export, there will be an
> > extra readdir operation triggered. If I write to an existent file, no
> > readdir operation will be triggered.
> I'm still pretty knew on this list too, but let me take a guess about
> what may be going on:
> Windows (by default) is case-insensitive, Unix is case-sensitive. So, if
> you write to a non existant file (let's call it "test.txt"), the kernel
> will tell samba that the file "test.txt" doesn't exist. However, there
> could be a file called "Test.txt" or "TEST.TXT", ... The open call won't
> tell that, the only way for samba to find out is to do a readdir and
> manually go through the list to see whether anything matches in a
> case-insensitive way.
> > How could I avoid the extra readdir operation in all cases when I am just
> > writing to a file?
> Switching samba to a case-sensitive mode might help, try putting the
> following into your smb.conf:
> case sensitive = yes
> if that alone doesn't help, you might try setting all 4 of the following:
> default case = lower
> sensitive = yes
> preserve case = no
> short preserve case = No
> Indeed, the smb.conf says the following:
> default case = upper/lower
> controls what the default case is for new filenames (ie. files that
> donŽt currently exist in the filesystem). Default lower. IMPORTANT
> NOTE: This option will be used to modify the case of all incoming
> client filenames, not just new filenames if the options case
> sensitive = yes, preserve case = No, short preserve case = No are
> set. This change is needed as part of the optimisations for
> directories containing large numbers of files.
> > Very much appreciate your help!
More information about the samba