git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] grep: take the read-lock when adding a submodule

From
Jeff King <peff@peff.net>
Date
Nov 1, 2017, 21:11 UTC
Message-ID
<20171101211159.qy2rnk7nmbaa4va3@sigill.intra.peff.net>
In-Reply-To
<20171101204506.5481-1-martin.agren@gmail.com>
On Wed, Nov 01, 2017 at 09:45:06PM +0100, Martin Ågren wrote:
Show 13 quoted lines
> With --recurse-submodules, we add each submodule that we encounter to
> the list of alternate object databases. With threading, our changes to
> the list are not protected against races. Indeed, ThreadSanitizer
> reports a race when we call `add_to_alternates_memory()` around the same
> time that another thread is reading in the list through
> `read_sha1_file()`.
> 
> Take the grep read-lock while adding the submodule. The lock is used to
> serialize uses of non-thread-safe parts of Git's API, including
> `read_sha1_file()`.
> 
> Helped-by: Brandon Williams <bmwill@google.com>
> Signed-off-by: Martin Ågren <martin.agren@gmail.com>
This looks good to me.
-Peff
Previous: Brandon Williams
Message 7 of 7 in “grep: turn off threading when recursing submodules”
  1. grep: turn off threading when recursing submodulesMartin Ågren, Oct 19, 2017
  2. Brandon WilliamsOct 19, 2017
  3. Jeff KingOct 19, 2017
  4. Martin ÅgrenOct 19, 2017
  5. grep: take the read-lock when adding a submoduleMartin Ågren, Nov 1, 2017
  6. Brandon WilliamsNov 1, 2017
  7. Jeff KingNov 1, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.