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

Re: [Bug] Git ReadOnly Temp Packfile Causes "Bad file descriptor" And -13 Access Error With NFSv4

From
Jeff King <peff@peff.net>
Date
Feb 11, 2025, 21:39 UTC
Message-ID
<20250211213940.GB3113114@coredump.intra.peff.net>
In-Reply-To
<Z6p-eIxzrFepC3py@tapette.crustytoothpaste.net>
On Mon, Feb 10, 2025 at 10:32:24PM +0000, brian m. carlson wrote:
Show 6 quoted lines
> > This is an issue for active/passive HA file servers. Since NFSv4 evaluates file permissions at the time of opening a file, this FD will always get an access denied error if a failover occurs during git clone.
> 
> I'm not sure there's even a good way to solve this problem on the Git
> side, since I suspect that if we opened the file as 0644 and then
> immediately did an fchmod to 0444, if you'd still fail here if the file
> is reopened.  Is that correct?

We could probably create and write the tempfile as 0644, and then switch it to 0444 before renaming it into place. We already do something similar with adjust_shared_perm(), I think.

I don't know if it's worth doing it that way or not. It should just work even on systems that are happy with the current code, so I think the only downside would be a few extra lines of code and an extra chmod() syscall.

-Peff
Previous: brian m. carlsonNext: brian m. carlson
Message 3 of 4 in “[Bug] Git ReadOnly Temp Packfile Causes "Bad file descriptor" And -13 Access Error With NFSv4”
  1. Maloney, BryanFeb 10, 2025
  2. brian m. carlsonFeb 10, 2025
  3. Jeff KingFeb 11, 2025
  4. brian m. carlsonFeb 11, 2025

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.