Sigh :-(. Removing optimization prematurely is the root of all evil :-(.
authorJeremy Allison <jra@samba.org>
Thu, 13 Sep 2012 17:13:21 +0000 (10:13 -0700)
committerKarolin Seeger <kseeger@samba.org>
Sun, 23 Sep 2012 00:58:48 +0000 (02:58 +0200)
commit47a2df0d966df771491510c58203d78bbfa5a152
tree066e19bc5100a4aa341bc5a958e499ee59809ee5
parentd8eb7c25db962af3fdb8b528635c1d81220a1bcf
Sigh :-(. Removing optimization prematurely is the root of all evil :-(.

Sorry for the mistake, but the LastDir singleton cache in vfs_ChDir()
actually plays an important role. When we're processing a stream of
SMB1/SMB2/SMB3 requests we don't want to add a chdir()/getcwd()
system call pair on every request if they're all on the same connection
and dealing with the same base path.

I did some testing with a program that times 1,000,000 chdir()
requests vs. 1,000,000 strcmp requests and it's a penalty of 10x
doing the system calls.

Just because it's old code, doesn't mean it's bad :-(.

Autobuild-User(master): Jeremy Allison <jra@samba.org>
Autobuild-Date(master): Thu Sep 13 21:31:42 CEST 2012 on sn-devel-104

Fix bug #9161 - We should re-add the vfs_Chdir() cache I removed.
source3/smbd/globals.c
source3/smbd/globals.h
source3/smbd/vfs.c