[PATCH] Re: max connections not working like 2.0.7

root root at samba.org
Mon May 14 05:19:18 GMT 2001

> How about another tdb? :-)  Have a tdb that is indexed by service name,
> and increment/decrement the number of connections when the connection is
> claimed and yeilded. Whats more, we only need to do this when 'max
> connections' is > 0, so performance isn't hit.  Finally, do a cleanup
> occasionaly to walk the connections.tdb to check that the
> maxconnections.tdb is correct.

If you use a tdb for this then don't just use a counter, otherwise we
will have no way of cleaning up when a smbd dies with a slot held.

Either use a file with single byte fcntl locks (which are auto-removed
by the OS) or if you wish to have a bit more info then use a tdb but
with each record containing an array of PIDs that are using the

hmmm, actually, you could use a straight counter and a tdb, and use
TDB_CLEAR_IF_FIRST. Then cleanup can be done by stopping/starting
smbd. Thats acceptable because a smbd dying without releasing a slot
should be a very rare event (basically has to be a segv or similar).

Alternatively, use the existing connections database and walk it at
connection time to determine the usage count. Expensive, but only used
if max_connections!=0

More information about the samba-technical mailing list