summaryrefslogtreecommitdiff
path: root/lib/ntdb/io.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2012-06-18 22:30:29 +0930
committerRusty Russell <rusty@rustcorp.com.au>2012-06-19 05:38:06 +0200
commit9396757676c304398a3e94ad01f2657e667b113c (patch)
treeca55222ca49c2d886f8717be73f3c403ed1a37c2 /lib/ntdb/io.c
parentdd4eed47591eeb6aafe5782690c1b550d0e3ebc4 (diff)
downloadsamba-9396757676c304398a3e94ad01f2657e667b113c.tar.gz
samba-9396757676c304398a3e94ad01f2657e667b113c.tar.bz2
samba-9396757676c304398a3e94ad01f2657e667b113c.zip
ntdb: make sure file is always a multiple of PAGESIZE (now NTDB_PGSIZE)
ntdb uses tdb's transaction code, and it has an undocumented but implicit assumption: that the transaction recovery area is always aligned to the transaction pagesize. This means that no block will overlap the recovery area. This is maintained by rounding the size of the database up, so do the same for ntdb. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'lib/ntdb/io.c')
-rw-r--r--lib/ntdb/io.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/lib/ntdb/io.c b/lib/ntdb/io.c
index 4580520fa2..e1518062b1 100644
--- a/lib/ntdb/io.c
+++ b/lib/ntdb/io.c
@@ -441,6 +441,7 @@ static enum NTDB_ERROR ntdb_expand_file(struct ntdb_context *ntdb,
char buf[8192];
enum NTDB_ERROR ecode;
+ assert((ntdb->file->map_size + addition) % NTDB_PGSIZE == 0);
if (ntdb->flags & NTDB_RDONLY) {
return ntdb_logerr(ntdb, NTDB_ERR_RDONLY, NTDB_LOG_USE_ERROR,
"Expand on read-only database");