summaryrefslogtreecommitdiffstats
path: root/source3/smbd/server_exit.c
Commit message (Collapse)AuthorAgeFilesLines
* s3:smbprofile: Replace sysv shmem with tdbVolker Lendecke2015-03-061-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | What? This patch gets rid of the central shared memory segment referenced by "profile_p". Instead, every smbd gets a static profile_area where it collects profiling data. Once a second, every smbd writes this profiling data into a record of its own in a "smbprofile.tdb". smbstatus -P does a tdb_traverse on this database and sums up what it finds. Why? At least in my perception sysv IPC has not the best reputation on earth. The code before this patch uses shmat(). Samba ages ago has developed a good abstraction of shared memory: It's called tdb. The main reason why I started this is that I have a request to become more flexible with profiling data. Samba should be able to collect data per share or per user, something which is almost impossible to do with a fixed structure. My idea is to for example install a profile area per share and every second marshall this into one tdb record indexed by share name. smbstatus -P would then also collect the data and either aggregate them or put them into individual per-share statistics. This flexibility in the data model is not really possible with one fixed structure. But isn't it slow? Well, I don't think so. I can't really prove it, but I do believe that on large boxes atomically incrementing a shared memory value for every SMB does show up due to NUMA effects. With this patch the hot code path is completely process-local. Once a second every smbd writes into a central tdb, this of course does atomic operations. But it's once a second, not on every SMB2 read. There's two places where I would like to improve things: With the current code all smbds wake up once a second. With 10,000 potentially idle smbds this will become noticable. That's why the current only starts the timer when something has changed. The second place is the tdb traverse: Right now traverse is blocking in the sense that when it has to switch hash chains it will block. With mutexes, this means a syscall. I have a traverse light in mind that works as follows: It assumes a locked hash chain and then walks the complete chain in one run without unlocking in between. This way the caller can do nonblocking locks in the first round and only do blocking locks in a second round. Also, a lot of syscall overhead will vanish. This way smbstatus -P will have almost zero impact on normal operations. Pair-Programmed-With: Stefan Metzmacher <metze@samba.org> Signed-off-by: Volker Lendecke <vl@samba.org> Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Ralph Boehme <slow@samba.org>
* s3:smbprofile: track connect_count and disconnect_countStefan Metzmacher2014-11-191-0/+1
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* smbd: Fix a use-after-freeVolker Lendecke2014-10-101-1/+4
| | | | | | | | | | We can't reference xconn->next after it was talloc_free'ed Signed-off-by: Volker Lendecke <vl@samba.org> Reviewed-by: Stefan Metzmacher <metze@samba.org> Autobuild-User(master): Stefan Metzmacher <metze@samba.org> Autobuild-Date(master): Fri Oct 10 14:32:53 CEST 2014 on sn-devel-104
* s3:smbd: introduce 'struct smbXsrv_client' in order to prepare multi-channel ↵Stefan Metzmacher2014-09-191-9/+34
| | | | | | | | | | support This structure is supposed to hold the global state shared between multiple connections from the same client. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: rename 'conn' to 'xconn' in exit_server_common()Stefan Metzmacher2014-08-061-10/+10
| | | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: move sconn->smb1.negprot.* to xconn->smb1.negprot.*Stefan Metzmacher2014-08-061-1/+1
| | | | | | | | This prepares the structures for multi-channel support. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: move sconn->status to xconn->transport.statusStefan Metzmacher2014-08-061-3/+3
| | | | | | | | This prepares the structures for multi-channel support. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org> Reviewed-by: Michael Adam <obnox@samba.org>
* s3:smbd: maintain smbd_server_connection->statusStefan Metzmacher2014-02-211-0/+11
| | | | | | | | | If this isn't NT_STATUS_OK, we skip any io on the socket. This avoids possible problems during shutdown. Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* s3:smbd: simplify exit_server_common()Stefan Metzmacher2014-02-211-4/+2
| | | | | Signed-off-by: Stefan Metzmacher <metze@samba.org> Reviewed-by: Volker Lendecke <vl@samba.org>
* param: rename lp function and variable from 'piddir' to 'pid_directory'Garming Sam2014-02-071-1/+1
| | | | | | Signed-off-by: Garming Sam <garming@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Jeremy Allison <jra@samba.org>
* Call smb_panic when we try to exit the server uncleanly. This gives us the ↵Richard Sharpe2013-03-271-7/+1
| | | | | | | | | | normal traceback and memory dump, but also runs the normal panic action. Signed-off-by: Richard Sharpe <realrichardsharpe@gmail.com> Reviewed-by: Jeremy Allison <jra@samba.org> Autobuild-User(master): Jeremy Allison <jra@samba.org> Autobuild-Date(master): Wed Mar 27 22:58:37 CET 2013 on sn-devel-104
* s3:smbd: add exit_server to the smbd_shim hooksStefan Metzmacher2012-10-191-2/+2
| | | | | | | | | This is in preparation of moving sessionid_tdb and conn_tdb to smbd exclusively. metze Signed-off-by: Michael Adam <obnox@samba.org>
* Move everything to use the common pidfile functions.Jeremy Allison2012-07-191-1/+2
| | | | The extra code in source3/lib/pidfile.c is no longer needed.
* Make the s3 pidfile use the common code inside lib/util/pidfile.cJeremy Allison2012-07-191-1/+1
|
* Move source4/smbd/pidfile into lib/util in preparation for making it in common.Jeremy Allison2012-07-191-1/+1
|
* s3:smbd: use smbXsrv_session_logoff_all() and smb1srv_tcon_disconnect_all() ↵Michael Adam2012-06-251-4/+32
| | | | | | | | in exit_server_common() This removes the use of conn_close_all() and invalidate_all_vuids() Pair-Programmed-With: Stefan Metzmacher <metze@samba.org>
* s3:smbd: make conn_close_all() a void functionStefan Metzmacher2012-06-031-1/+1
| | | | metze
* We are triggering the cleanup_timeout_fn() too often, on exiting when an ↵Jeremy Allison2012-05-311-11/+4
| | | | | | | smbd is idle. Calls to exit_server_cleanly() should be treated as a "clean" shutdown, and not trigger the master smbd to call cleanup_timeout_fn.
* s3:smbd: use server_messaging_context() instead of sconn->msg_ctx in ↵Stefan Metzmacher2012-05-311-2/+3
| | | | | | | | | | | | | exit_server_common() sconn is not available in the parent anymore. Thanks to Volker Lendecke <vl@samba.org> for finding this! metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu May 31 18:08:06 CEST 2012 on sn-devel-104
* s3:smbd: remove global 'smbd_server_conn' !!!Stefan Metzmacher2012-05-241-2/+8
| | | | | | | | | | For now we still use a global 'global_smbXsrv_connection' in order to pass the connection state to exit_server*(). metze Autobuild-User: Stefan Metzmacher <metze@samba.org> Autobuild-Date: Thu May 24 20:07:20 CEST 2012 on sn-devel-104
* s3:smbd: avoid using sconn_server_id()Stefan Metzmacher2011-12-161-1/+2
| | | | metze
* s3:smb2 fix smbd crash on premature end of smb2 conn (Bug 8286)Christian Ambach2011-07-041-3/+3
| | | | | | | | | | | | | when smbd tries to clean up locks after a premature end of a smb2 connection, lock_db has already been freed and so it crashes this patch changes the order in which items are freed so that lock_db is still around when it is needed Jeremy, Metze, please check Autobuild-User: Christian Ambach <ambi@samba.org> Autobuild-Date: Mon Jul 4 20:00:26 CEST 2011 on sn-devel-104
* s3: include ntdomain.h before including generated srv_ headers.Günther Deschner2011-05-021-1/+1
| | | | Guenther
* s3-messages: make ndr_messaging.h part of messages.h.Günther Deschner2011-03-301-1/+0
| | | | Guenther
* s3: include smbd/smbd.h where needed.Günther Deschner2011-03-301-0/+1
| | | | Guenther
* s3-fault: removed the cont_fn from fault_setup()Andrew Tridgell2011-03-221-5/+0
| | | | | | | | | | cont_fn() was supposed to be a way to continue after a seg fault. It could never be called however, as smb_panic() from fault_report() could never return, as dump_core() never returns at the end of smb_panic() Autobuild-User: Andrew Tridgell <tridge@samba.org> Autobuild-Date: Tue Mar 22 05:07:58 CET 2011 on sn-devel-104
* s3-server_id: only include server_id where needed.Günther Deschner2011-03-021-0/+1
| | | | Guenther
* s3-printing: only include printing where really needed.Günther Deschner2011-02-221-0/+1
| | | | Guenther
* s3-printing: isolate print notification prototypes better.Günther Deschner2011-02-221-0/+1
| | | | Guenther
* s3-rpcecho: Only register rpcecho in the developer build.Andreas Schneider2011-01-041-0/+2
| | | | | Autobuild-User: Andreas Schneider <asn@samba.org> Autobuild-Date: Tue Jan 4 18:56:38 CET 2011 on sn-devel-104
* s3-smbd: Call the rpc service shutdown functions.Andreas Schneider2011-01-041-0/+34
|
* s3-smbd Remove manual override of DEBUGELVEL during exitAndrew Bartlett2010-10-271-5/+0
| | | | | | | | This code, originally added at the dawn of time (the import into CVS) does not seem to be required any more, as all the DEBUG() statements in the intermediate functions are at level 0. Andrew Bartlett
* s3: Remove smbd_server_conn from files_forallVolker Lendecke2010-09-281-5/+4
|
* s3-auth: Simplify how we free the auth_contextSimo Sorce2010-07-191-2/+1
| | | | | | | | | Turn the freeing function into a destructor and attach it to the auth_context. Make all callers TALLOC_FREE() the auth_context instead of calling the free function. Signed-off-by: Andrew Bartlett <abartlet@samba.org>
* s3: Remove smbd_messaging_context() from exit_server_common()Volker Lendecke2010-07-051-1/+1
|
* s3: Remove procid_self() from exit_server_commonVolker Lendecke2010-07-051-1/+1
|
* s3: Remove serverid_[de]register_selfVolker Lendecke2010-07-041-1/+1
| | | | This removes some deep references to procid_self()
* s3: Don't attempt to deregister from serverid twiceVolker Lendecke2010-07-041-1/+6
| | | | | The parent has to take care of crashed child processes anyway, so we don't have to clean up in the child
* s3:lib make server contexts genericSimo Sorce2010-06-101-2/+2
| | | | Pair-programmed-with: Andreas Schneider <asn@samba.org>
* Don't use the autofree context for the globals. This causes child smbd's forkedJeremy Allison2010-06-101-0/+1
| | | | | | | by modules to crash due to destructors being called (found when using the vfs_aio_fork module with smb2). Jeremy.
* s3:smbd split smbd/server.c into smbd/server.c and smbd/server_exit.cAndrew Bartlett2010-05-281-0/+173
Andrew Bartlett Signed-off-by: Stefan Metzmacher <metze@samba.org>