libsmbclient/smbc_opendir problem with large directories.

Henrik Zagerholm henke at
Mon Jun 12 19:59:31 GMT 2006

12 jun 2006 kl. 19:06 skrev Dave Daugherty:

> On Monday, June 12, 2006 5:51 AM Henrik Zagerholm Wrote:
>> Hi Samba team,
>> I'm currently coding some C++ wrapper functions around  
>> libsmbclient.c.
>> I experience really weird results when dealing with directories with
> many dir
>> entries ( With my setup/hardware around 2000+ )
>> smbc_opendir returns a valid smbc_file but the dir entries are not
> complete
>> (their names are truncated to one character)
>> It seems to be a timeout problem because when I run my testprogram
> against
>> the same client the problem disappears as the files get  cached on  
>> the
> client.
>> After flushing the file cache on the client the problem returns.
>> Is there a more controllable way of getting dir entries?
>> Are there more timeout variables other than context->timeout that I
> can
>> manipulate?
>> Setting context->timeout to high values seems to solve the problem
> but is
>> there a better way to handle this?
>> (E.g reading only a part of the entries at a time)
>> Increasing the timeout really isn't a viable solution as I can never
> be sure
>> how many dir entries a client has or the performance of its   
>> hardware.
> Are you sure that the files being returned are not in Unicode, but you
> think they are in ASCII? That would explain just one character.
Yes I am as the filenames does not contain any weird characters and  
the problem only occurs if I have a short timeout and occurs more  
frequently if I Harddrive IO intensive tasks on the client while  

I am about to set up a test program using derrell's own code see if I  
get different results but so far the problem still exists.

So far I think it has something to do with enumerating large  
directories while the hardrive is busy and have a shorter timeout.
Is there a way to limit the number of dir entries that smbc_opendir  
returns and only return let say 100 at a time?
I'll do some more tests before submitting to bugzilla.

> Dave Daugherty
> Centrify Corp.


More information about the samba-technical mailing list