Bug 9161 - We should re-add the vfs_Chdir() cache I removed.
Summary: We should re-add the vfs_Chdir() cache I removed.
Alias: None
Product: Samba 4.0
Classification: Unclassified
Component: File services (show other bugs)
Version: 4.0.0rc1
Hardware: All All
: P5 normal (vote)
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
Depends on:
Reported: 2012-09-13 19:56 UTC by Jeremy Allison
Modified: 2012-09-18 06:44 UTC (History)
0 users

See Also:

git-am fix for 4.0.0. (2.51 KB, patch)
2012-09-13 19:56 UTC, Jeremy Allison
vl: review+

Note You need to log in before you can comment on or make changes to this bug.
Description Jeremy Allison 2012-09-13 19:56:43 UTC
Created attachment 7893 [details]
git-am fix for 4.0.0.

From the commit I added to master (56b752512597acaffa94a979ef9140760e0f5cf3)

    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 :-(.

Comment 1 Volker Lendecke 2012-09-13 20:17:04 UTC
Comment on attachment 7893 [details]
git-am fix for 4.0.0.

The real fix for this is to work with absolute paths always, but this looks fine given we're not going to make that switch for 4.0 :-)
Comment 2 Jeremy Allison 2012-09-13 20:37:16 UTC
Re-assigning to Karolin for inclusion in 4.0.0.

Thanks !

Comment 3 Karolin Seeger 2012-09-18 06:44:33 UTC
Pushed to v4-0-test.
Closing out bug report.