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

Re: Non-robust lock files in containers can lead to repo corruption

From
Jeff King <peff@peff.net>
Date
Aug 12, 2019, 16:38 UTC
Message-ID
<20190812163812.GB26231@sigill.intra.peff.net>
In-Reply-To
<qimq0i$49gn$1@blaine.gmane.org>
On Sat, Aug 10, 2019 at 09:05:33AM -0700, Gregory Szorc wrote:
Show 7 quoted lines
> I tracked down a source of Git corrupting repositories to lock file
> design not being robust when containers / PID namespaces are present.
> 
> In my case, the corruption stemmed from premature release of the `git
> gc` lock in the gc.pid file. But since the lock file code for that file
> is in gc.c, there could be other lock files in Git affected by the same
> design limitation as well.

I don't think there are. Most of Git's locks are predicated purely on the existence of the lockfile (with the intent that they'd work over systems like NFS). The gc lock is a weird one-off.

And while it's not great for multiple gc's to run at the same time (because it wastes CPU), two of them running at the same time shouldn't cause a corruption. If you have a reproducible demonstration where that happens, I'd be very interested to see it.

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 4 of 5 in “Non-robust lock files in containers can lead to repo corruption”
  1. Gregory SzorcAug 10, 2019
  2. Randall S. BeckerAug 12, 2019
  3. Junio C HamanoAug 12, 2019
  4. Jeff KingAug 12, 2019
  5. Junio C HamanoAug 13, 2019

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.