[Samba] smbd reads entire directory when creating files?

Jeremy Allison jra at samba.org
Tue Dec 7 21:25:00 GMT 2004


On Tue, Dec 07, 2004 at 02:08:56PM -0600, Matt Mitchell wrote:
> Apologies if this is a FAQ.

Kind of.

> We are saddled with some directories full of production image files that 
> number in the hundreds of thousands to the millions.  (Yes, I know this 
> is bad.)  They reside on a couple of Win 2003 boxes that are flaky and 
> unreliable.  I was hoping to copy them over to a Linux box running samba 
> but it is taking forever.

This is pretty much the worse case scenario for Samba I'm afraid.

> A strace on the smbd process receiving the files from the windows box 
> (it is mapped as a share on the 2k3 server) reveals that smbd is looking 
> up the entire directory (with getdents64) every time it writes a file. 
> Several times, in fact.  So as the number of files grows, it churns more 
> and more.  I'm sure most of it is in cache but the data still has to be 
> moved around in memory.
> 
> I know this is not necessary for writing/copying files with unix 
> semantics, but I wonder if the case-fiddling or any other Windows 
> imitative behavior is making this getdents64 orgy necessary.  Is there 
> any way to disable it?

Not currently. This is something I'm working on - would you be
willing to test some prototype code once I'm done ?

Jeremy.


More information about the samba mailing list