[Samba] libsmbclient: readdir caches dirents?

Jeremy Allison jra at samba.org
Wed Feb 18 18:54:24 GMT 2009

On Wed, Feb 04, 2009 at 06:48:04PM +0000, Geoff Johnstone wrote:
> I'm using libsmbclient with smbc contexts.
> If I do an smbc_readdir() of a directory X then I get a
> bunch of (correct) dirents.
> I then smbc_rmdir() a subdirectory X/Y, which succeeds.
> A subsequent smbc_readdir(), using the same smbc
> context, still gives a dirent for X/Y.
> I've observed this with libsmbclient from Samba 3.2.4,
> 3.2.7 and 3.3.0, talking to Samba and Win2K3 servers.
> Two questions:
>   1. Does libsmbclient cache readdir results?
>   2. How do I fix it (ideally without recreating the context)?

So long as the directory handle is kept open then
libsmbclient caches the contents. If you're manipulating
the directory contents you should close and re-open the
handle after delete. I agree it kind of sucks, but
we don't have the code in place to handle cache
removals whilst open right now.


More information about the samba mailing list