Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Jeff Hostetler
On 8/15/2017 3:21 PM, Martin Ågren wrote: On 15 August 2017 at 20:48, Stefan Beller wrote: /* total number of entries (0 means the hashmap is empty) */ - unsigned int size; + /* -1 means size is unknown for threading reasons */ + int size;

Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Martin Ågren
On 15 August 2017 at 20:48, Stefan Beller wrote: /* total number of entries (0 means the hashmap is empty) */ - unsigned int size; + /* -1 means size is unknown for threading reasons */ + int size; >>> >>> This double-encodes the

Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Stefan Beller
>>> /* total number of entries (0 means the hashmap is empty) */ >>> - unsigned int size; >>> + /* -1 means size is unknown for threading reasons */ >>> + int size; >> >> This double-encodes the state of disallow_rehash (i.e. if we had >> signed size, then the invariant

Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Martin Ågren
On 15 August 2017 at 20:17, Stefan Beller wrote: > On Tue, Aug 15, 2017 at 10:59 AM, Jeff Hostetler > wrote: >> >> >> On 8/15/2017 8:53 AM, Martin Ågren wrote: >>> >>> Using SANITIZE=thread made t3008-ls-files-lazy-init-name-hash.sh hit >>> the

Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Stefan Beller
On Tue, Aug 15, 2017 at 10:59 AM, Jeff Hostetler wrote: > > > On 8/15/2017 8:53 AM, Martin Ågren wrote: >> >> Using SANITIZE=thread made t3008-ls-files-lazy-init-name-hash.sh hit >> the potential race below. >> >> What seems to happen is, threaded_lazy_init_name_hash ends

Re: tsan: t3008: hashmap_add touches size from multiple threads

2017-08-15 Thread Jeff Hostetler
On 8/15/2017 8:53 AM, Martin Ågren wrote: Using SANITIZE=thread made t3008-ls-files-lazy-init-name-hash.sh hit the potential race below. What seems to happen is, threaded_lazy_init_name_hash ends up using hashmap_add on the_index.dir_hash from two threads in a way that tsan considers racy.