Article View: linux.kernel.git
Article #4340Re: [PATCH] reftable/writer: fsync table after writing its footer
From: Aman Ganapathy
Date: Fri, 04 Dec 2026 18:25
Date: Fri, 04 Dec 2026 18:25
37 lines
12141 bytes
12141 bytes
On Fri, Dec 04, 2026 at 07:53:15AM +0100, Patrick Steinhardt wrote:
> This failure mode is quite surprising. I would have expected that we die
> with a lot of noise and refuse to do anything in case the reftable stack
> is corrupt. Did you by any chance also investigate why that's the case?
I hadn't yet, so I traced a path through the code now. As I see it, the
stack fails to load in reftable_be_init(), which saves the error in
refs->err and doesn't print anything. Every ref read after that fails,
but the error gets lost on the way up.
If you look up a single ref, refs_resolve_ref_unsafe() just returns NULL,
which is the same as when the ref doesn't exist. So "git rev-parse HEAD"
says "unknown revision", like in an empty repo.
If you list refs, the error does come back, but for-each-ref and gc don't
check it. So for-each-ref prints nothing, and gc thinks nothing is
reachable and prunes everything.
You can see it by cutting the footer off the newest table:
git init -q --ref-format=reftable repo && cd repo
git commit -q --allow-empty -m one
t=.git/reftable/$(tail -1 .git/reftable/tables.list)
truncate -s -68 "$t"
git rev-parse HEAD # "unknown revision"
git for-each-ref # prints nothing, exits 0
With the files backend, a truncated packed-refs dies right away with
"unterminated line in .git/packed-refs", so I'd expect the same here.
Should reftable_be_init() just die when the stack is corrupt, or is there
a reason the error is kept for later? Happy to send a patch for it if
need be!
Thanks for the review!
Aman
Technical Details
Message-ID:
<20261204182535.76118-1-amanganapathy@gmail.com>Path:
mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-77030-linux-kernel-git=dewy.ruReferences:
<axJjW4vzZnafA_z-@pks.im>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!feed-us-txt.newsdeef.eu!feed-us-mi.newsdeef.eu!srv.newsdeef.eu!newsfeed.endofthelinebbs.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-77030-linux-kernel-git=dewy.ru
From: amanganapathy@gmail.com (Aman Ganapathy)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH] reftable/writer: fsync table after writing its footer
Date: Fri, 4 Dec 2026 10:25:35 -0800
Organization: Usenet Network
Message-ID: <20261204182535.76118-1-amanganapathy@gmail.com>
References: <axJjW4vzZnafA_z-@pks.im>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2829858"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:BgaxP0rsM/6VkYyABbuZStT6UI0= sha256:MI/VgDJ0pauVyEpZPLpvUHvcUxg9MRbsEsBXGnUcjDA=
sha1:Dsh1EYVBBpFcrpicYzpT8k1roBQ= sha256:SRgkZMWpWwmWzTWpMra9aAUC3/xuUcy+oDoBU8VhZzQ=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
by mail.dewy.ru (Postfix) with ESMTP id 63C67117C91; Fri, 4 Dec 2026 21:26:45 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.197
X-Spam-Status: No, score=-2.197 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.001,
MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
with ESMTP id UY9MzuJ0Ex6d;
Fri, 4 Dec 2026 21:26:43 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-77030-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN>
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
by mail.dewy.ru (Postfix) with ESMTPS id B39DA117C0E; Fri, 4 Dec 2026 21:26:30 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
by sea.lore.kernel.org (Postfix) with ESMTP id 7489467A91; Fri, 4 Dec 2026 18:25:54 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
t=1796408739;
b=E6qNlmQKuvfzM4TsyRP3MRTfxcwFjdLd2sF6hFqt2sWGIxHM/XWVYhv8VPRWJZjSZHnd
5HoaVdeAEnMee0UmGh+82uoqd0E9+uBEGNE33KyXDaUBtBLOQvUe09tFdxb8Ng3y0oTUt
9Jr4ir93Q7NWWnc+UdqxcHQ64C/Ap0bVSoPyGzLhu8KMgZPhw30ojze+8+7JoOIhb8ckp
K7GBauYrbdSBGEBlJqjk9DIedYA0GW7yVrtMpT5IMdbfE4JyAyhOYg+NB0RzfbY5WlXxK
cy8d9QvruwRm4SFcqbpdt+srGmHFjEflEI/uAEIMBW0PkjH2v/iJQ1CpdDZ2g8MpcSQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796408739;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
Received:From:To:Cc:Subject:Date:Message-Id:X-Mailer:In-Reply-To:
References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
List-Unsubscribe:List-Owner:Precedence:MIME-Version:
Content-Transfer-Encoding;
bh=4uXh6oMcTmf3zf93BNolhOGHs3kfck4uL5zQhQmBH7s=;
b=NlncEx+Qz8K899fFUgVlYIBX28DMM8oJDuKAfw7Jk/FEXg/XEoAVmDdJEUvkZOLlSeT+
4fhw1AIRVXsltZ6Bge4kNnsnHmXcncm4tyPwkhPNihk/FkC8HFOliZIAFohgOKHvsGdhR
FdYFYqEV/8qViGnWy0Bye4MAnWif8pdl1tYy97i8V+nHdY8v04QQ4xGyGOiUu6KRj+FH6
/rI6IBVjlmCgGSEQuhbd30dYVdhgofoC+dW8t3rGT+ODxBEXdnxD8yh7ErCmWej5GHWYp
gtiJFMFsQ48iJhNtQDf2o9cNmfpfGTx4nFI43JaDXdgTzHwAh40NIchCrAwieLoegCQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=t7dIblzD;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
by smtp.subspace.kernel.org (Postfix) with ESMTP id DB34760A260A;
Fri, 4 Dec 2026 18:25:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=t7dIblzD
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=74.125.82.42
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796408739;
b=ygIflbS6QAnEowmt3CYwko9mdH2XrVXqMqTvg76HuFbHqRTejYS5/GRvLZWJD8utFvtV
1J9aGKRPMomn6KgiUPv1I4tzbXv47xbVkSg//mLndFk/bAKZVfOcKkltQR05yGsZaqw53
uoLquVDG/nPeqc8PtEUn2jSnsQ2R8k7nqBgAmX/oYTYDaVitQ1mMoFVWl9ItezHf5Gewo
f4HEzBuzRDFXyi9oU/rnnoMfGYCQskzLK6dRxmqLuk1FVYS4p4O40w2fJ9au1lpsLExzW
feommvAf8v7EcpJTfwrCh1zuX8wzOYCVVPP3SXzDKGSU0pOZWKXC3Y1l6lGL75D6SLA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796408739;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
Date:Message-Id:X-Mailer:In-Reply-To:References:MIME-Version:
Content-Transfer-Encoding;
bh=4uXh6oMcTmf3zf93BNolhOGHs3kfck4uL5zQhQmBH7s=;
b=qngShpnHg3YE1cqV7gfpHsb2+k9eYSk63PMoiTlLrrUeeD27kTrBwhyOIjMIAGnGOdUM
JbyH8YAs7xl5hY4mq9BMLLcxRqqTeWQfW34j0743muz4rKJST4D7cxES0DXMyYrPQEXUv
mCZKy0Y/G3b31BeL/o13pJzYe8uR4yxHerT1J1JWHLvzb0xhp/k/GdbuxtNHWd5+aRbJI
xIq96jDVk0jcaieEhaGGblxdapuT+CTDEX5oGblpV8yTBQXFZ98eHGFmve95MagrHO5WK
AuyQCg1zRsSHoH1Q9piXmxYqNUVfRlGXbshhJbfJ4BKmskBOdSrZ4Xnwt4lh8/I9iCA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org;
dmarc=pass header.from=gmail.com;
spf=pass smtp.mailfrom=gmail.com;
dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=t7dIblzD;
arc=none smtp.remote-ip=74.125.82.42
X-Received: from mail-dl1-f42.google.com (mail-dl1-f42.google.com [74.125.82.42])
(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
(No client certificate requested)
by smtp.subspace.kernel.org (Postfix) with ESMTPS id B59CD606A6BB
for <git@vger.kernel.org>; Fri, 4 Dec 2026 18:25:38 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B59CD606A6BB
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-dl1-f42.google.com with SMTP id a92af1059eb24-1b5d5f12565so1073534c88.1
for <git@vger.kernel.org>; Fri, 04 Dec 2026 10:25:38 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796408738; x=1797013538; darn=vger.kernel.org;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=4uXh6oMcTmf3zf93BNolhOGHs3kfck4uL5zQhQmBH7s=;
b=t7dIblzDRAFMvN71KUyzpVlJn8uJWOJdsBVAqvh9q7A23RbU0OEnKthrZvU+3N6cg+
yqglgh3sUzGgMK+xMkgASBbOPBbl1Xkm+ifOUX+AkhD+bfAtYoOYLsQTDj67h0s4LniH
Qcdz0rBLPpGjubR2GunhxSDydV2VWz95Warc/e69VrFGC0QID0iGJagrKKL6OVTtyfhM
UY18gVyWHn+Agk/iso7CT+TFmABhjDK5r8Vr6VoS+NpRgM24k5vznrsc1V+JXN6DJn07
HHFJZyjkqxc/PHnNhgYmXMMJfm+BQOr9TrTXHw9qjZEeo1oMqV1RNTD5euisAF6DF1c3
uNKg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796408738; x=1797013538;
h=content-transfer-encoding:mime-version:references:in-reply-to
:message-id:date:subject:cc:to:from:x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+1R4qOjttTqQa9CQD63CEVCAWeHmsUbW
n74+9AJmm0xGtQb9JAz0p6lppZjTSQJwH2GD2vYaJE0XVyFnh8K59Mk5ya7zks+4qBCMdRjGtOF
2k7csPWfpRgsiEX10m5jI4Aq11l1by1PgUk4oUkMvxeyBNll3ZtOWFM6ujFFco7uoxQGx3smxHP
Z8ul+QEoCHiWgq0C5KqVwE1Vo549dLPdCTqHrFj9s/J4g
X-Received: by 2002:a05:701a:cc95:20b0:1b5:bcda:2c7e with SMTP id a92af1059eb24-1b5d7114b2dmr2427280c88.16.1796408737761;
Fri, 04 Dec 2026 10:25:37 -0800 (PST)
X-Received: from localhost.localdomain ([2601:645:c100:ab8f:a453:914a:6bd1:2a12])
by smtp.gmail.com with ESMTPSA id a92af1059eb24-1b5d646217esm7971506c88.11.2026.12.04.10.25.36
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Fri, 04 Dec 2026 10:25:37 -0800 (PST)
X-Cc: git@vger.kernel.org,
John Cai <johncai86@gmail.com>
X-Mailer: git-send-email 2.39.5 (Apple Git-154)
X-In-Reply-To: <axJjW4vzZnafA_z-@pks.im>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list