From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Subject: [PATCH 0/2] reftable/stack: fix race in up-to-date check
Date: Thu, 18 Jan 2024 14:41:46 +0100 [thread overview]
Message-ID: <cover.1705585037.git.ps@pks.im> (raw)
[-- Attachment #1: Type: text/plain, Size: 1225 bytes --]
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
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next reply other threads:[~2024-01-18 13:41 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-18 13:41 Patrick Steinhardt [this message]
2024-01-18 13:41 ` [PATCH 1/2] reftable/stack: unconditionally reload stack after commit Patrick Steinhardt
2024-01-18 13:41 ` [PATCH 2/2] reftable/stack: fix race in up-to-date check Patrick Steinhardt
2024-01-18 20:07 ` Junio C Hamano
2024-01-20 1:05 ` Jeff King
2024-01-22 10:32 ` Patrick Steinhardt
2024-01-23 0:32 ` Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1705585037.git.ps@pks.im \
--to=ps@pks.im \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).