[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-32-11-g0b39c04

Simo Sorce idra at samba.org
Wed Sep 3 18:36:00 GMT 2008


The branch, v3-0-test has been updated
       via  0b39c04fed2720aad07544c65a57b6580ae322a0 (commit)
      from  09145720b510647e7c24e3062a4a1246cc7bff5b (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 0b39c04fed2720aad07544c65a57b6580ae322a0
Author: Simo Sorce <idra at samba.org>
Date:   Wed Sep 3 10:44:09 2008 -0400

    The msync manpage reports that msync *must* be called before munmap. Failure to do so may result in lost data. Fix an ifdef check, I really think we meant to check HAVE_MMAP here.

-----------------------------------------------------------------------

Summary of changes:
 source/tdb/common/io.c          |    8 +++++++-
 source/tdb/common/transaction.c |    2 +-
 2 files changed, 8 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/tdb/common/io.c b/source/tdb/common/io.c
index 4b7e33a..df66816 100644
--- a/source/tdb/common/io.c
+++ b/source/tdb/common/io.c
@@ -190,7 +190,13 @@ int tdb_munmap(struct tdb_context *tdb)
 
 #ifdef HAVE_MMAP
 	if (tdb->map_ptr) {
-		int ret = munmap(tdb->map_ptr, tdb->map_size);
+		int ret;
+
+		ret = msync(tdb->map_ptr, tdb->map_size, MS_SYNC);
+		if (ret != 0)
+			return ret;
+
+		ret = munmap(tdb->map_ptr, tdb->map_size);
 		if (ret != 0)
 			return ret;
 	}
diff --git a/source/tdb/common/transaction.c b/source/tdb/common/transaction.c
index 8bda651..50d6534 100644
--- a/source/tdb/common/transaction.c
+++ b/source/tdb/common/transaction.c
@@ -551,7 +551,7 @@ static int transaction_sync(struct tdb_context *tdb, tdb_off_t offset, tdb_len_t
 		TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_transaction: fsync failed\n"));
 		return -1;
 	}
-#ifdef MS_SYNC
+#ifdef HAVE_MMAP
 	if (tdb->map_ptr) {
 		tdb_off_t moffset = offset & ~(tdb->page_size-1);
 		if (msync(moffset + (char *)tdb->map_ptr, 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list