[SCM] Samba Shared Repository - branch v3-3-test updated -
release-3-2-0pre2-3934-gde8f483
Simo Sorce
idra at samba.org
Wed Sep 3 18:29:21 GMT 2008
The branch, v3-3-test has been updated
via de8f483254ec59c7cf678d8c03e07c0c241f6d7b (commit)
from e1d4db8f55b25c7e9c408cb334fb89ccfd4c6565 (commit)
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-3-test
- Log -----------------------------------------------------------------
commit de8f483254ec59c7cf678d8c03e07c0c241f6d7b
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/lib/tdb/common/io.c | 8 +++++++-
source/lib/tdb/common/transaction.c | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
Changeset truncated at 500 lines:
diff --git a/source/lib/tdb/common/io.c b/source/lib/tdb/common/io.c
index 172ab69..4ec18de 100644
--- a/source/lib/tdb/common/io.c
+++ b/source/lib/tdb/common/io.c
@@ -189,7 +189,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/lib/tdb/common/transaction.c b/source/lib/tdb/common/transaction.c
index 4e2127b..7acda64 100644
--- a/source/lib/tdb/common/transaction.c
+++ b/source/lib/tdb/common/transaction.c
@@ -563,7 +563,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