diff options
author | Jeremy Allison <jra@samba.org> | 2004-02-19 01:55:21 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-02-19 01:55:21 +0000 |
commit | cc5dc7cb6733c27ec763f8e660aaeb321563fa1e (patch) | |
tree | 6e1961231a3cbfcfa902cfedb17b7f281180e977 /source3/smbd/session.c | |
parent | 9be8961cc98f59079bccaeaf98eec964741d6f1a (diff) | |
download | samba-cc5dc7cb6733c27ec763f8e660aaeb321563fa1e.tar.gz samba-cc5dc7cb6733c27ec763f8e660aaeb321563fa1e.tar.bz2 samba-cc5dc7cb6733c27ec763f8e660aaeb321563fa1e.zip |
Fix the "too many fcntl locks" scalability problem raised by tridge.
I've now tested this in daemon mode and also on xinetd and I'm pretty
sure it's working.
Jeremy.
(This used to be commit f3e51dbc21c616d261f0a65b9fa69dbb8b5a9a0f)
Diffstat (limited to 'source3/smbd/session.c')
-rw-r--r-- | source3/smbd/session.c | 29 |
1 files changed, 19 insertions, 10 deletions
diff --git a/source3/smbd/session.c b/source3/smbd/session.c index a811a6e305..61118f13dd 100644 --- a/source3/smbd/session.c +++ b/source3/smbd/session.c @@ -28,6 +28,22 @@ #include "includes.h" static TDB_CONTEXT *tdb; + +BOOL session_init(void) +{ + if (tdb) + return True; + + tdb = tdb_open_ex(lock_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, + O_RDWR | O_CREAT, 0644, smbd_tdb_log); + if (!tdb) { + DEBUG(1,("session_init: failed to open sessionid tdb\n")); + return False; + } + + return True; +} + /* called when a session is created */ BOOL session_claim(user_struct *vuser) { @@ -52,14 +68,8 @@ BOOL session_claim(user_struct *vuser) return True; } - if (!tdb) { - tdb = tdb_open_ex(lock_path("sessionid.tdb"), 0, TDB_CLEAR_IF_FIRST|TDB_DEFAULT, - O_RDWR | O_CREAT, 0644, smbd_tdb_log); - if (!tdb) { - DEBUG(1,("session_claim: failed to open sessionid tdb\n")); - return False; - } - } + if (!session_init()) + return False; ZERO_STRUCT(sessionid); @@ -190,7 +200,7 @@ void session_yield(user_struct *vuser) static BOOL session_traverse(int (*fn)(TDB_CONTEXT *, TDB_DATA, TDB_DATA, void *), void *state) { - if (!tdb) { + if (!session_init()) { DEBUG(3, ("No tdb opened\n")); return False; } @@ -238,4 +248,3 @@ int list_sessions(struct sessionid **session_list) *session_list = sesslist.sessions; return sesslist.count; } - |