Removing most chdir() calls (was Re: What was/is the purpose of the getwd cache?)

Andrew Bartlett abartlet at
Tue Jun 19 20:28:39 MDT 2012

On Wed, 2012-06-13 at 09:10 -0700, Jeremy Allison wrote:
> On Wed, Jun 13, 2012 at 01:58:34PM +0200, Volker Lendecke wrote:
> > 
> > Thinking about a more radical change (that would definitely
> > fuel the parallel OEM discussion): The s4 file server works
> > with absolute path names, s3 does a chdir to the share root
> > for every smb request. This is a pretty deep assumption that
> > from my point of view is broken. If we look for a point to
> > change that (it affects the VFS), 4.0 would be it. If we got
> > rid of relative path names, getwd would be simple: Always
> > return /. No caching required.
> I'm ok with this conceptually, but it requires a lot of code change.
> If it gets done, that's great, but I don't think it's a 4.0.0
> blocker.

One way that it might become such a blocker is related to our ACL
handling.  As I understand it, the only calls to chdir() in the s4 ntvfs
server are in the 'override ACL by being root' code, in order to do so
safely.  By removing the chdir to the root of the share, and always
using an absolute path, changing to the directory for ACL handling
becomes possible. 

We currently have issues where, at least with version 1 security.NTACL
(as layed out by provision), we don't trump the security.NTACL over the
posix permissions.

There may be other was to fix this, but I wanted to point out this
approach and the ntacl issue in case it helped make this a worthwhile


Andrew Bartlett

Andrew Bartlett                      
Authentication Developer, Samba Team 

More information about the samba-technical mailing list