Skip to content

reftable/stack: fix race in up-to-date check

Patrick Steinhardt git 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 4 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2reftable/stack: unconditionally reload stack after commitreftable/stack.c+1 -10 replies
2/2reftable/stack: fix race in up-to-date checkreftable/stack.c reftable/stack.h reftable/system.h+95 -94 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

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

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

Signature · 1 line
2.43.GIT