What is required to make schannel.tdb TDB_CLEAR_IF_FIRST
idra at samba.org
Mon Jun 14 12:14:09 MDT 2010
On Sun, 2010-06-13 at 08:35 +1000, Andrew Bartlett wrote:
> On Sat, 2010-06-12 at 10:21 -0400, simo wrote:
> > On Sat, 2010-06-12 at 18:23 +1000, Andrew Bartlett wrote:
> > > The semantics of schannel are quite clear (from windows behaviour on
> > > reboots), that it is reasonable to reset this database - schannel.tdb -
> > > at any time.
> > >
> > > As such, it should be an ideal candidate for TDB_CLEAR_IF_FIRST. What
> > > I'm wondering is, what do I need to do to implement this? What are the
> > > rules about TDB_CLEAR_IF_FIRST databases, and how do I set one up
> > > correctly?
> > >
> > > I'm asking this because my new ext4 based development system seems to
> > > spend a very, very large amount of time in fsync() due to schannel
> > > operations, whenever I'm doing a Samba4 'make test'.
> > >
> > > (I know there is a hack patch to disable fsync here in metze's repo
> > > somewhere, but that's not the point...)
> > Hi Andrew,
> > when I worked on schannel.tdb I considered using NOSYNC and
> > TDB_CLEAR_IF_FIRST (necessary if you do not guarantee consistency).
> > The reason I didn't do that is that Metze felt we should not loose the
> > database if we stop and restart samba. That's what would happen with
> > TDB_CLEAR_IF_FIRST.
> > If resetting the schannel.tdb with a "service smb restart" is fine then
> > we can certainly use TDB_CLEAR_IF_FIRST and stop paying the price of
> > syncing the file.
> I think we gain far more by killing the fsync() and allowing format
> changes than we gain by allowing restarts.
> Can you remind me what I have to do to set that up? The idea would be
> to create a helper function that opens the DB, and call that from the
> main() of Samba3's smbd and Samba4's server, right? I then 'open' it
> again in the schannel code with TDB_CLEAR_IF_FIRST and the rest is
Looks like the other way around AFAIK.
You use always TDB_CLEAR_IF_FIRST and just make sure you open (and keep
open) the TDB in main(). So the main() one is always the first and
always cleans the TDB on restart, while any other caller cannot clear it
because it is not the "first" (does not have the lock).
Samba Team GPL Compliance Officer <simo at samba.org>
Principal Software Engineer at Red Hat, Inc. <simo at redhat.com>
More information about the samba-technical