• Patrick Hogg's avatar
    pack-objects: move read mutex to packing_data struct · 459307b1
    Patrick Hogg authored
    ac77d0c3 ("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: 's avatarPatrick Hogg <phogg@novamoon.net>
    Reviewed-by: Duy Nguyen's avatarDuy Nguyen <pclouds@gmail.com>
    Signed-off-by: 's avatarJunio C Hamano <gitster@pobox.com>
    459307b1
pack-objects.h 12 KB