diff options
author | Jeremy Allison <jra@samba.org> | 2004-02-19 01:55:24 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-02-19 01:55:24 +0000 |
commit | 8eec62ebfb238133d95d7247b7126292f47c7093 (patch) | |
tree | 5d3894f97ced64d8e2753603a2ea25897d831c51 /source3/smbd/session.c | |
parent | 5e39e9f3130e48917db9d9802623befa536df399 (diff) | |
download | samba-8eec62ebfb238133d95d7247b7126292f47c7093.tar.gz samba-8eec62ebfb238133d95d7247b7126292f47c7093.tar.bz2 samba-8eec62ebfb238133d95d7247b7126292f47c7093.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 14dee038019b11300466b148c53515fc76e5e870)
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; } - |