tdb: Make robust against shrinking tdbs
authorRusty Russell <rusty@rustcorp.com.au>
Sat, 6 Oct 2012 11:23:05 +0000 (13:23 +0200)
committerVolker Lendecke <vl@samba.org>
Sat, 6 Oct 2012 11:23:41 +0000 (13:23 +0200)
commit37fd93194db10fc832ed3fa1ec880ebc26be904b
tree6ee8e6ef1d15123fc4775cc687c872f6d77ea842
parent828793852f3785c620f2716c60f8b1640880ee50
tdb: Make robust against shrinking tdbs

When probing for a size change (eg. just before tdb_expand, tdb_check,
tdb_rescue) we call tdb_oob(tdb, tdb->map_size, 1, 1).  Unfortunately
this does nothing if the tdb has actually shrunk, which as Volker
demonstrated, can actually happen if a "longlived" parent crashes.

So move the map/update size/remap before the limit check.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
lib/tdb/common/io.c