Author: stefan2
Date: Mon Jun 22 16:54:03 2015
New Revision: 1686898
URL: http://svn.apache.org/r1686898
Log:
On the fsx-1.10 branch:
Fix the second of 3 multi-threading issues with the batch fsync code.
Because the application pool handed in to our init-code may be single-
threaded, we can't use it to allocate a thread-pool because the threads
inside it will create and destroy sub-pools in various threads.
* subversion/libsvn_fs_x/batch_fsync.c
(svn_fs_x__batch_fsync_init): Create the thread pool in a thread-safe
global pool. Drop the now unused pool
parameter.
* subversion/libsvn_fs_x/batch_fsync.h
(svn_fs_x__batch_fsync_init): Update declaration to match the source.
* subversion/libsvn_fs_x/fs.c
(svn_fs_x__init): Update caller.
* subversion/tests/libsvn_fs_x/fs-x-pack-test.c
(test_batch_fsync): Same.
Modified:
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.c
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.h
subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.c
subversion/branches/fsx-1.10/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.c?rev=1686898&r1=1686897&r2=1686898&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.c Mon Jun
22 16:54:03 2015
@@ -231,14 +231,16 @@ static apr_thread_pool_t *thread_pool =
#define FILE_FLAGS (APR_READ | APR_WRITE | APR_BUFFERED | APR_CREATE)
svn_error_t *
-svn_fs_x__batch_fsync_init(apr_pool_t *global_pool)
+svn_fs_x__batch_fsync_init()
{
#ifdef APR_HAS_THREADS
+ /* The thread-pool must be allocated from a thread-safe pool.
+ GLOBAL_POOL may be single-threaded, though. */
+ apr_pool_t *pool = svn_pool_create(NULL);
/* This thread pool will get cleaned up automatically when GLOBAL_POOL
gets cleared. No additional cleanup callback is needed. */
- WRAP_APR_ERR(apr_thread_pool_create(&thread_pool, 0, MAX_THREADS,
- global_pool),
+ WRAP_APR_ERR(apr_thread_pool_create(&thread_pool, 0, MAX_THREADS, pool),
_("Can't create fsync thread pool in FSX"));
/* let idle threads linger for a while in case more requests are
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.h
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.h?rev=1686898&r1=1686897&r2=1686898&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.h (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/batch_fsync.h Mon Jun
22 16:54:03 2015
@@ -44,14 +44,13 @@
*/
typedef struct svn_fs_x__batch_fsync_t svn_fs_x__batch_fsync_t;
-/* Initialize the concurrent fsync infrastructure. It will automatically
- * be cleaned up when GLOBAL_POOL is being cleaned up.
+/* Initialize the concurrent fsync infrastructure.
*
* This function must be called before using any of the other functions in
* in this module. It should only be called once.
*/
svn_error_t *
-svn_fs_x__batch_fsync_init(apr_pool_t *global_pool);
+svn_fs_x__batch_fsync_init(void);
/* Set *RESULT_P to a new batch fsync structure, allocated in RESULT_POOL. */
svn_error_t *
Modified: subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.c?rev=1686898&r1=1686897&r2=1686898&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.c (original)
+++ subversion/branches/fsx-1.10/subversion/libsvn_fs_x/fs.c Mon Jun 22
16:54:03 2015
@@ -664,7 +664,7 @@ svn_fs_x__init(const svn_version_t *load
loader_version->major);
SVN_ERR(svn_ver_check_list2(x_version(), checklist, svn_ver_equal));
- SVN_ERR(svn_fs_x__batch_fsync_init(common_pool));
+ SVN_ERR(svn_fs_x__batch_fsync_init());
*vtable = &library_vtable;
return SVN_NO_ERROR;
Modified:
subversion/branches/fsx-1.10/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
URL:
http://svn.apache.org/viewvc/subversion/branches/fsx-1.10/subversion/tests/libsvn_fs_x/fs-x-pack-test.c?rev=1686898&r1=1686897&r2=1686898&view=diff
==============================================================================
--- subversion/branches/fsx-1.10/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
(original)
+++ subversion/branches/fsx-1.10/subversion/tests/libsvn_fs_x/fs-x-pack-test.c
Mon Jun 22 16:54:03 2015
@@ -864,7 +864,7 @@ test_batch_fsync(const svn_test_opts_t *
/* Initialize infrastructure with a pool that lives as long as this
* application. */
- SVN_ERR(svn_fs_x__batch_fsync_init(svn_pool_create(NULL)));
+ SVN_ERR(svn_fs_x__batch_fsync_init());
/* We use and re-use the same batch object throughout this test. */
SVN_ERR(svn_fs_x__batch_fsync_create(&batch, pool));