ntdb for Samba 4.2?

Michael Adam obnox at samba.org
Thu Mar 20 05:12:49 MDT 2014


On 2014-03-20 at 11:35 +0100, Volker Lendecke wrote:
> On Thu, Mar 20, 2014 at 03:33:01PM +1030, Rusty Russell wrote:
> > 
> > But:
> >         5f7b481349796cc0e90563ed01353809b403e429 tdb: Fix a tdb corruption
> > 
> > I don't understand how this can corrupt?  A test case should be fairly
> > simple, but I think this change is unnecessary.
> 
> The test case is simple: Run tdbtorture after adding
> TDB_VOLATILE to the open flag. The problem is that with the
> 
>         rec_ptr = tdb_find_lock_hash(tdb, key, hash, F_WRLCK, &rec);
> 
> in common.c:393 we read the full record including the .next
> pointer. tdb_purge_dead (line 412) can change rec.next in
> the database: If rec.next points at a dead record, then
> tdb_purge_dead will modify rec.next on disk without
> modifying the copy on tdb_delete_hash's stack. Without
> 5f7b481349796cc0e90563ed01353809b403e429 we forced our copy
> to disk, including the now invalid rec.next. The patch
> changes the write call such that only the magic value is
> changed, the rest is untouched.

Rusty,

Please note that this corruption had only
been added recently by my patch
"cde8e290c9195cbc7a2388455df9e76a1f36135f"
wich was intended to simplify the code.
It moved the searching of the record to be deleted
to a common place at the top, before the purge_dead
is called. I missed the subtlety that was discovered
by Volker.

So Volker's patch was not necessary before my patch,
now it is. (alternative would have been to revert my
patch, but I think this way it is even better. :-)

Sorry, for the fuss..

Cheers - Michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 215 bytes
Desc: Digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20140320/98fe471d/attachment.pgp>


More information about the samba-technical mailing list