diff options
author | Patrick Hogg <phogg@novamoon.net> | 2019-01-24 19:22:03 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2019-01-28 11:22:06 -0800 |
commit | 459307b139c9a859ca0b6ca5276cf9be3d2b8e3e (patch) | |
tree | 8ca32b5889cf2278a5269a73fd3521f2869747af /pack-objects.c | |
parent | 0d0ac3826a3bbb9247e39e12623bbcfdd722f24c (diff) | |
download | git-459307b139c9a859ca0b6ca5276cf9be3d2b8e3e.tar.gz |
pack-objects: move read mutex to packing_data struct
ac77d0c37 ("pack-objects: shrink size field in struct object_entry",
2018-04-14) added an extra usage of read_lock/read_unlock in the newly
introduced oe_get_size_slow for thread safety in parallel calls to
try_delta(). Unfortunately oe_get_size_slow is also used in serial
code, some of which is called before the first invocation of
ll_find_deltas. As such the read mutex is not guaranteed to be
initialized.
Resolve this by moving the read mutex to packing_data and initializing
it in prepare_packing_data which is initialized in cmd_pack_objects.
Signed-off-by: Patrick Hogg <phogg@novamoon.net>
Reviewed-by: Duy Nguyen <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'pack-objects.c')
-rw-r--r-- | pack-objects.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/pack-objects.c b/pack-objects.c index b6cdbb0166..3554c43ac2 100644 --- a/pack-objects.c +++ b/pack-objects.c @@ -150,6 +150,7 @@ void prepare_packing_data(struct packing_data *pdata) 1UL << OE_DELTA_SIZE_BITS); #ifndef NO_PTHREADS pthread_mutex_init(&pdata->lock, NULL); + init_recursive_mutex(&pdata->read_lock); #endif } |