find_first2 lookup behaviour on Samba with a case Insensitive FS

James Peach jorgar at
Thu May 29 04:09:32 GMT 2008

2008/5/28 David Disseldorp <ddiss at>:
> Hi,
> I've been testing Samba 3.2 on a Case Insensitive (CI) XFS filesystem[1]
> with fs_capabilities set accordingly. Running into an interesting issue.
> Test Case:
> - map the CI XFS backed Samba share as z:
> - open a cmd window
> - z:
> - mkdir lowercasedir
> the prompt will then appear as z:\LOWERCASEDIR> rather than
> z:\lowercasedir> as shown on a stock Samba (no CI filesys) or NTFS.
> This is due to the name returned by a find_first2 SMB, which is obtained
> via unix_convert() where:
>  - a stat of any case variant will succeed on a CI filesys
>    -> the same name is returned
>  - a stat of case variant will fail on case sensitive filesys
>    -> falls through to perform a directory scan
>    -> if the file is found during the directory scan, the file name
>       as it is stored on disk is returned
> Aside from maybe confusing users, could this behaviour cause problems
> for applications?

Yes this causes problems for OSX 10.5. You need to return the
canonical on-disk case in all cases. There is a patch in the Apple
tree to do this for Darwin.


IIRC, we also had some fixes to the rename path, when you rename a
file to a case-variation of the existing name:


> I'll post the CI XFS Samba patch after a cleanup and a few runs of
> James's RAW-BENCH-LOOKUP test.

Was there much to do? I thought I had pushed all the HFS+
case-insensitivity patches ...

James Peach | jorgar at

More information about the samba-technical mailing list