diff --git a/evolution-data-server-2.25.92-sqlite-fsync-rework.patch b/evolution-data-server-2.25.92-sqlite-fsync-rework.patch index 252a02b..195f7aa 100644 --- a/evolution-data-server-2.25.92-sqlite-fsync-rework.patch +++ b/evolution-data-server-2.25.92-sqlite-fsync-rework.patch @@ -1,7 +1,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evolution-data-server-2.25.92/camel/camel-db.c --- evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework 2009-02-04 12:28:12.000000000 -0500 -+++ evolution-data-server-2.25.92/camel/camel-db.c 2009-03-12 14:25:00.000000000 -0400 -@@ -36,239 +36,114 @@ ++++ evolution-data-server-2.25.92/camel/camel-db.c 2009-03-13 11:59:49.000000000 -0400 +@@ -36,239 +36,112 @@ #include "camel-debug.h" @@ -12,7 +12,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol static sqlite3_vfs *old_vfs = NULL; - GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT; +-GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT; -GStaticRecMutex sync_queue_lock = G_STATIC_REC_MUTEX_INIT; -#define LockQueue() g_static_rec_mutex_lock (&sync_queue_lock) -#define UnlockQueue() g_static_rec_mutex_unlock (&sync_queue_lock) @@ -24,7 +24,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol -typedef struct _sync_queue_data { - guint timeout_source; /* id of the source */ - GThread *running_thread; - +- - int sync_flags; -} sync_queue_data; - @@ -67,12 +67,13 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol { - int sync_flags = 0; - sync_queue_data *data; -- -- g_return_val_if_fail (pFile != NULL, NULL); -- g_return_val_if_fail (sync_queue != NULL, NULL); + gpointer data; + gint flags = 0; +- g_return_val_if_fail (pFile != NULL, NULL); +- g_return_val_if_fail (sync_queue != NULL, NULL); ++ g_async_queue_ref (cFile->queue); + - LockQueue (); - data = g_hash_table_lookup (sync_queue, pFile); - if (data) { @@ -101,8 +102,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol - g_free (data); - } - UnlockQueue (); -+ g_async_queue_ref (cFile->queue); - +- - return NULL; -} + while (TRUE) { @@ -176,10 +176,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol - data->sync_flags = data->sync_flags | flags; - } else { - data->sync_flags = data->sync_flags | flags; -+ /* One more for the road? */ -+ if (getenv ("CAMEL_NO_SYNC_ON_CLOSE") == NULL) -+ call_old_file_Sync (cFile, flags); - +- - /* reschedule */ - g_source_remove (data->timeout_source); - data->timeout_source = g_timeout_add (SYNC_TIMEOUT, prepare_to_run_sync_in_thread, pFile); @@ -189,11 +186,14 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol - data->sync_flags = flags; - data->running_thread = NULL; - data->timeout_source = g_timeout_add (SYNC_TIMEOUT, prepare_to_run_sync_in_thread, pFile); -+ g_async_queue_unref (cFile->queue); ++ /* One more for the road? */ ++ if (flags != 0 && getenv ("CAMEL_NO_SYNC_ON_CLOSE") == NULL) ++ call_old_file_Sync (cFile, flags); - g_hash_table_insert (sync_queue, pFile, data); - } -- ++ g_async_queue_unref (cFile->queue); + - UnlockQueue (); + return NULL; } @@ -301,7 +301,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol g_return_val_if_fail (cFile->old_vfs_file->pMethods != NULL, SQLITE_ERROR); \ return cFile->old_vfs_file->pMethods->_nm _call; \ } -@@ -293,15 +168,41 @@ def_subclassed (xDeviceCharacteristics, +@@ -293,15 +166,41 @@ def_subclassed (xDeviceCharacteristics, static int camel_sqlite3_file_xClose (sqlite3_file *pFile) { @@ -346,7 +346,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol if (cFile->old_vfs_file->pMethods) res = cFile->old_vfs_file->pMethods->xClose (cFile->old_vfs_file); else -@@ -316,10 +217,26 @@ camel_sqlite3_file_xClose (sqlite3_file +@@ -316,10 +215,30 @@ camel_sqlite3_file_xClose (sqlite3_file static int camel_sqlite3_file_xSync (sqlite3_file *pFile, int flags) { @@ -365,18 +365,24 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol + /* If a sync request is already scheduled, accumulate flags. */ + cFile->flags |= flags; + -+ if (cFile->timeout_id == 0) -+ cFile->timeout_id = g_timeout_add_seconds ( -+ SYNC_TIMEOUT_SECONDS, (GSourceFunc) -+ sync_push_request, cFile); ++ /* Cancel any pending sync requests. */ ++ if (cFile->timeout_id > 0) ++ g_source_remove (cFile->timeout_id); ++ ++ /* Wait SYNC_TIMEOUT_SECONDS before we actually sync. */ ++ cFile->timeout_id = g_timeout_add_seconds ( ++ SYNC_TIMEOUT_SECONDS, (GSourceFunc) ++ sync_push_request, cFile); + + g_async_queue_unlock (cFile->queue); return SQLITE_OK; } -@@ -328,14 +245,24 @@ static int +@@ -327,15 +246,26 @@ camel_sqlite3_file_xSync (sqlite3_file * + static int camel_sqlite3_vfs_xOpen (sqlite3_vfs *pVfs, const char *zPath, sqlite3_file *pFile, int flags, int *pOutFlags) { ++ static GStaticRecMutex only_once_lock = G_STATIC_REC_MUTEX_INIT; static sqlite3_io_methods io_methods = {0}; - struct CamelSqlite3File *cFile; + CamelSqlite3File *cFile; @@ -401,7 +407,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol res = old_vfs->xOpen (old_vfs, zPath, cFile->old_vfs_file, flags, pOutFlags); -@@ -370,33 +297,23 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pV +@@ -370,33 +300,23 @@ camel_sqlite3_vfs_xOpen (sqlite3_vfs *pV return res; } @@ -439,7 +445,7 @@ diff -up evolution-data-server-2.25.92/camel/camel-db.c.sqlite-fsync-rework evol } #define d(x) if (camel_debug("sqlite")) x -@@ -453,12 +370,13 @@ cdb_sql_exec (sqlite3 *db, const char* s +@@ -453,12 +373,13 @@ cdb_sql_exec (sqlite3 *db, const char* s CamelDB * camel_db_open (const char *path, CamelException *ex) { diff --git a/evolution-data-server.spec b/evolution-data-server.spec index 9383569..79091f1 100644 --- a/evolution-data-server.spec +++ b/evolution-data-server.spec @@ -31,7 +31,7 @@ Name: evolution-data-server Version: 2.25.92 -Release: 3%{?dist} +Release: 4%{?dist} Group: System Environment/Libraries Summary: Backend data server for Evolution License: LGPLv2+ @@ -389,6 +389,9 @@ rm -rf $RPM_BUILD_ROOT %{_datadir}/gtk-doc/html/libedataserverui %changelog +* Fri Mar 13 2009 Matthew Barnes - 2.25.92-4.fc11 +- Revise patch for RH bug #568332 to match upstream commit. + * Thu Mar 12 2009 Matthew Barnes - 2.25.92-3.fc11 - Add patch for RH bug #568332 (thread leak in fsync() rate limiting).