Samba - CPU and memory usage - Proposed solution(?)

Michael B Allen mba2000 at
Sun Jan 23 08:51:43 GMT 2005

On Sun, 23 Jan 2005 04:40:00 +0200
"Nikos Balkanas" <nbalk at> wrote:

> > jra applied some patches to ensure that the directory listing was not
> > performed.
> Do you mean to say that an exact "stat" is performed in this case?
> Wouldn't it be more efficient from the beginning to do 2 "stats" - 1 for
> upper case, the other for lower case? Even in the case where the exact
> name is known from the database, there is no guarantee that windows
> filesystem will request the same case from Unix. Can one do wildcard
> matching in this case?

If the path requested does not exist the server MUST search the files
within each directory and do a case insensitive comparison on each to
prove that the file does not exist. However, if the file does exist,
usually the case provided is correct. So as an optimization you can just
stat(2) for that component and only do the directory listing search if
it fails. Additionally if you simply stat(2) the entire path requested
at the very beginning and it exists you can skip the multiple stats and
directory searches altogether.

I'm not terribly familar with Samba but apparently the version you're
using lacks some of these optimizations.


Greedo shoots first? Not in my Star Wars.

More information about the samba-technical mailing list