changes to .tdb files lost

Volker Lendecke Volker.Lendecke at SerNet.DE
Fri Sep 9 20:26:55 GMT 2005

On Fri, Sep 09, 2005 at 12:17:53PM +0200, Pierre Filippone wrote:
> We use SLES 9 SP 2. 'mmap = no' solves it. 
> Meanwhile I found this in the msync man page:
>        msync  flushes  changes made to the in-core copy of a file
>        that was mapped into memory using mmap(2)  back  to  disk.
>        Without  use  of  this  call  there  is  no guarantee that
>        changes are written back before munmap(2) is  called.
> I tried an "msync(tdb->map_ptr, tdb->map_size, MS_SYNC);" right before the 
> munmap() in tdb/tdb.c and it fixes the problem. Changes are still there 
> after reboot.

Thanks for that manpage reference. I had also already found that 'use mmap=no'
fixes it. I've been digging through pages but I did not find
any reference whether it is legal to throw away changed mmap pages on close. I
can see that they are not written to disc without some kind of sync, but I
would call not syncing on a normal shutdown a bug.

What about syncing at each real tdb_unlock if the tdb is not clear_if_first?
The clear_if_first don't have to survive a reboot anyway, and they are the
most speed-criticial ones.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url :

More information about the samba-technical mailing list