Hi!

I've noticed that txn-list operations are not being synchronized on Windows
around trunk@1568806.   FSFS makes use of two different types of locks: there
are mutexes synchronizing the fcntl file locking (POSIX only) and ordinary
mutexes (e.g. txn-list-lock).  The former are only required on POSIX, the
latter, however, should be enabled under all OSes.

Since r1182459 [1], the txn-list-lock mutex is being erroneously enabled and
disabled under the same condition as the mutexes required for the fcntl locking
mechanism to work.  This effectively makes the txn-list operations work without
any serialization on Windows.

I have attached a patch that fixes this problem.  Log message:
[[[
Ensure that access to the transaction list and free transaction pointer is
properly synchronized on Windows.  Before this changeset, the corresponding
txn-list-lock mutex was being enabled/disabled under the same condition as
the mutexes required for the POSIX fcntl file locking.  This effectively ended
up in no synchronization for the txn-list operations on Windows.

* subversion/libsvn_fs_fs/fs.c
  (fs_serialized_init): Unconditionally enable the TXN_LIST_LOCK mutex.

Patch by: Evgeny Kotkov <evgeny.kotkov{_AT_}visualsvn.com>
]]]

[1] http://svn.apache.org/viewvc?view=revision&revision=r1182459


Thanks and regards,
Evgeny Kotkov
Index: subversion/libsvn_fs_fs/fs.c
===================================================================
--- subversion/libsvn_fs_fs/fs.c        (revision 1568806)
+++ subversion/libsvn_fs_fs/fs.c        (working copy)
@@ -103,8 +103,10 @@ fs_serialized_init(svn_fs_t *fs, apr_pool_t *commo
       SVN_ERR(svn_mutex__init(&ffsd->txn_current_lock,
                               SVN_FS_FS__USE_LOCK_MUTEX, common_pool));
 
-      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock,
-                              SVN_FS_FS__USE_LOCK_MUTEX, common_pool));
+      /* We also need a mutex for synchronizing access to the active
+         transaction list and free transaction pointer.  This one is
+         enabled unconditionally. */
+      SVN_ERR(svn_mutex__init(&ffsd->txn_list_lock, TRUE, common_pool));
 
       key = apr_pstrdup(common_pool, key);
       status = apr_pool_userdata_set(ffsd, key, NULL, common_pool);

Reply via email to