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

[PATCH 0/2] reftable/stack: fix race in up-to-date check

From
Patrick Steinhardt <ps@pks.im>
Date
Jan 18, 2024, 13:41 UTC
Message-ID
<cover.1705585037.git.ps@pks.im>
Hi,

In 6fdfaf15 (reftable/stack: use stat info to avoid re-reading stack list, 2024-01-11) we have introduced a new mechanism to avoid re-reading the table list in case stat(3P) figures out that the stack didn't change since the last time we read it.

Unfortunately, I've been able to hit a bug there that can happen under very specific circumstances when a reading and writing process race with each other. When the writer appends to the stack and then compacts it, it may happen that we recycle the previously-used inode of "tables.list" so that the resulting `struct stat` exactly matches the cached value of the reading process.

The first patch is merely cosmetic, whereas the second patch fixes the described race. The topic depends on ps/reftable-optimize-io, which has introduced the issue.

Patrick
Patrick Steinhardt (2):
  reftable/stack: unconditionally reload stack after commit
  reftable/stack: fix race in up-to-date check
 reftable/stack.c  | 101 ++++++++++++++++++++++++++++++++++++++++++----
 reftable/stack.h  |   4 +-
 reftable/system.h |   1 -
 3 files changed, 96 insertions(+), 10 deletions(-)
base-commit: 718a93ecc06ed59dda4e6a5d91b1c2169275694f
-- 
2.43.GIT
Next: Patrick Steinhardt
Message 1 of 7 in “reftable/stack: fix race in up-to-date check”
  1. 0/2 reftable/stack: fix race in up-to-date checkPatrick Steinhardt, Jan 18, 2024
  2. 1/2 reftable/stack: unconditionally reload stack after commitPatrick Steinhardt, Jan 18, 2024
  3. 2/2 reftable/stack: fix race in up-to-date checkPatrick Steinhardt, Jan 18, 2024
  4. Junio C HamanoJan 18, 2024
  5. Jeff KingJan 20, 2024
  6. Patrick SteinhardtJan 22, 2024
  7. Jeff KingJan 23, 2024

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.