Here's another iteration of this patch addressing Malcom's comments.
Review/comments and testing on Linux would be appreciated.
Fix the undefined behavior invoked when the fs module is dynamically
unloaded and the bdb cache tries to clean itself up.
This occurred because the bdb cache was allocated in the global pool
which gets cleaned up *after* the fs module has been unloaded from
memory (meaning the cleanup hook code may or may not still
actually be there depending on what the OS does with the newly freed
The fix is to pass the fs module's common_pool down to the fs_base
and fs_fs module's init routines so that they can allocate fs global
stuff and know that they can clean it up before they are unloaded.
In addition, this changes the fs modules vtables to get rid of the
function. Instead, we serialize open/create calls passing them the
common_pool and they then call their own init functions internally
(svn_fs_bdb__init): Add a pool parameter that we can use to store
the bdb cache in since it is fs module scoped.
(svn_fs_bdb__init, bdb_init_cb): Add and use the new fs module
scoped pool for the bdb cache.
(fs_vtable): Drop serialized_init function.
(base_create, base_open, base_open_for_recovery): Add common_pool
parameter and pass it on to the internal init functions as needed.
(svn_fs_base__init): Add common_pool parameter and pass it on
to the underlying init functions.
(svn_fs_initialize): Update docs to note that undefined behavior can
result if the fs module is dynamically loaded and the bdb fs is used.
(svn_atomic__init_once): Add pool parameter.
(fs_library_vtable_t): Add common_pool parameter to create, open
and open_for_recovery functions.
(fs_init_func_t): Add common_pool parameter.
(svn_fs_base__init, svn_fs_fs__init): Add common_pool parameter.
(fs_vtable_t): Get rid of the serialized_init function which is now called
internally by the open or create functions.
(common_pool): Document usage changes for common_pool.
(serialized_init): Dropped and moved the best-effort common_pool init to...
(get_library_vtable_direct): here in order to init it earlier when
svn_fs_initialize is not called. Also pass the common_pool on
to the init function for the underlying fs module.
(acquire_fs_mutex, release_fs_mutex): New functions to get and drop
the mutex guarding the fs module's common_pool.
(svn_fs_create, svn_fs_open, svn_fs_recovery, svn_fs_create_berkeley,
svn_fs_open_berkeley): Pass the common_pool parameter on to the
underlying fs' functions after acquiring the fs mutex to serialize the
(svn_atomic__init_once): Add pool parameter and pass it to
(fs_vtable): Drop the serialized_init function which is now called internally
by the open/create/open_for_recovery functions as needed.
(fs_create, fs_open, fs_open_for_recovery): Add common_pool parameter
and pass it on to internal init functions as needed.
(svn_fs_fs__init): Add common_pool parameter.
Received on Mon Apr 16 04:32:26 2007
To unsubscribe, e-mail: firstname.lastname@example.org
For additional commands, e-mail: email@example.com