From 9396757676c304398a3e94ad01f2657e667b113c Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Mon, 18 Jun 2012 22:30:29 +0930 Subject: 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 --- lib/ntdb/io.c | 1 + 1 file changed, 1 insertion(+) (limited to 'lib/ntdb/io.c') 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"); -- cgit