Skip Menu |

Subject: profile locking at wrong level when re-reading file
With the profile-sharing code enabled, the mutex protects the linked
list of prf_data_t objects and their refcounts. However, once one of
these objects has been acquired for a profile instance, it's used
without locking. Mostly it's read-only access, but if the on-disk file
has changed, the tree of nodes will be freed and rebuilt, with no mutex
Changes just checked in today to deal with this, at least in most cases.
* prof_int.h (struct _prf_data_t): Add a mutex.
* prof_file.c (profile_open_file): Initialize data mutex.
(profile_update_file_data, profile_flush_file_data): Lock it while manipulating
file data.
(profile_lock_global, profile_unlock_global): New functions.
* prof_set.c (rw_setup): Acquire global lock while checking flags and adjusting
ref count.
(profile_update_relation, profile_rename_section, profile_add_relation): Lock
data mutex while manipulating profile data.
* prof_tree.c (profile_node_iterator): Do more magic number tests.
Author: Ken Raeburn <>
Commit: b06c64321b0cef679623d264f19ba64e625d1f32
Branch: master
src/util/profile/ChangeLog   |  15 +++++++
src/util/profile/prof_file.c |  60 +++++++++++++++++++++-----
src/util/profile/prof_int.h  |   8 ++++
src/util/profile/prof_set.c  | 100 +++++++++++++++++++++++++++----------------
src/util/profile/prof_tree.c |   9 +++-
5 files changed, 142 insertions(+), 50 deletions(-)