diff options
author | Andrew Tridgell <tridge@samba.org> | 2004-10-29 07:29:26 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 13:05:00 -0500 |
commit | dbf03959244c392073281c10badd2095397ad2f2 (patch) | |
tree | 427e9fb6143cd2a2b66b6804a8c5339272115e47 /source4/smbd/service.c | |
parent | 0caeda53d37740d18b38e6d37d0ecef8c6336820 (diff) | |
download | samba-dbf03959244c392073281c10badd2095397ad2f2.tar.gz samba-dbf03959244c392073281c10badd2095397ad2f2.tar.xz samba-dbf03959244c392073281c10badd2095397ad2f2.zip |
r3357: removed the need to use TDB_CLEAR_IF_FIRST in Samba4.
We found a few months ago that TDB_CLEAR_IF_FIRST is extremely
inefficient for large numbers of connections, due to a fundamental
limitation in the way posix byte range locking is implemented. Rather
than the nasty workaround we had for Samba3, we now have a single
"cleanup tmp files" function that runs when smbd starts. That deletes
the tmp tdbs, so TDB_CLEAR_IF_FIRST is not needed at all.
(This used to be commit ffa285bc783c775a2d53a58fb691ca339e6c76ae)
Diffstat (limited to 'source4/smbd/service.c')
-rw-r--r-- | source4/smbd/service.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source4/smbd/service.c b/source4/smbd/service.c index ca5f5e75316..33c0d5fcbdf 100644 --- a/source4/smbd/service.c +++ b/source4/smbd/service.c @@ -349,3 +349,33 @@ void service_close_listening_sockets(struct server_context *srv_ctx) } } } + + +/* + cleanup temporary files. This is the new alternative to + TDB_CLEAR_IF_FIRST. Unfortunately TDB_CLEAR_IF_FIRST is not + efficient on unix systems due to the lack of scaling of the byte + range locking system. So instead of putting the burden on tdb to + cleanup tmp files, this function deletes them. You need to expand + the list here as appropriate. +*/ +void service_cleanup_tmp_files(void) +{ + const char *list[] = { + "openfiles.tdb", + "brlock.tdb", + "unexpected.tdb"}; + int i; + for (i=0;i<ARRAY_SIZE(list);i++) { + char *path = lock_path(NULL, list[i]); + int ret; + ret = unlink(path); + if (ret == -1 && + errno != ENOENT && + errno != ENOTDIR) { + DEBUG(0,("Failed to cleanup '%s'\n", path)); + smb_panic("unable to cleanup temporary files\n"); + } + talloc_free(path); + } +} |