diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-11-17 09:01:20 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-11-17 09:49:12 -0800 |
commit | 7c4ea599b0d44e46c4f96bf955b62d96126b53ff (patch) | |
tree | 67d2fb34dd65d47532ff84943c933bc3abdd3844 /hash.c | |
parent | Add cache preload facility (diff) | |
download | tgif-7c4ea599b0d44e46c4f96bf955b62d96126b53ff.tar.xz |
Fix index preloading for racy dirty case
In the threaded index preloading case, we must be sure to always use the
CE_MATCH_RACY_IS_DIRTY flag when calling ie_match_stat(), in order to make
sure that we only ever look at the stat() data, and don't try to do
anything fancy.
Because most of git internals are not thread-safe, and must not be called
in parallel.
Otherwise, what happens is that if the timestamps indicate that an entry
_might_ be dirty, we might start actually comparing filesystem data with
the object database. And we mustn't do that, because that would involve
looking up and creating the object structure, and that whole code sequence
with read_sha1_file() where we look up and add objects to the hashes is
definitely not thread-safe.
Nor do we want to add locking, because the whole point of the preload was
to be simple and not affect anything else. With CE_MATCH_RACY_IS_DIRTY, we
get what we wanted, and we'll just leave the hard cases well alone, to be
done later in the much simpler serial case.
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'hash.c')
0 files changed, 0 insertions, 0 deletions