Zhang Bingjun (Eddy)
2010-May-12 08:16 UTC
[Samba] extra readdir operation when writing to a non-existent file
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. How could I avoid the extra readdir operation in all cases when I am just writing to a file? Very much appreciate your help! I used samba (3.4.0) to export a FUSE mount from Ubuntu with the following smb.cnf: ---------------------------------------------------------------- [global] security = share guest account = nobody [mofs] path = /mnt/mofs public = yes guest ok = yes guest only = yes guest account = nobody writeable = yes browseable = yes ----------------------------------------------------------------
Alain Knaff
2010-May-12 08:33 UTC
[Samba] extra readdir operation when writing to a non-existent file
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!Regards, Alain
Alain Knaff
2010-May-12 08:46 UTC
[Samba] extra readdir operation when writing to a non-existent file
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!Regards, Alain
Zhang Bingjun (Eddy)
2010-May-12 09:35 UTC
[Samba] extra readdir operation when writing to a non-existent file
Hi Alain, Your suggestion works. Thank you very much! Best regards, 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! > > Regards, > > Alain >
Apparently Analagous Threads
- Equivalent of pxechain.com for (USB key based) syslinux
- [PATCH] fs: fix call to fs_ops->readdir
- parallel-readdir is not recognized in GlusterFS 3.12.4
- parallel-readdir is not recognized in GlusterFS 3.12.4
- parallel-readdir is not recognized in GlusterFS 3.12.4