git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nicolas Pitre <nico@cam.org>
To: "Shawn O. Pearce" <spearce@spearce.org>
Cc: Robin Rosenberg <robin.rosenberg@dewire.com>, git@vger.kernel.org
Subject: Re: [JGIT PATCH 1/2] index-pack: Avoid disk corruption yielding a valid pack footer checksum
Date: Wed, 27 Aug 2008 20:09:49 -0400 (EDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0808272007541.1624@xanadu.home> (raw)
In-Reply-To: <1219873724-13348-1-git-send-email-spearce@spearce.org>

On Wed, 27 Aug 2008, Shawn O. Pearce wrote:

> When we are processing a thin pack and making it non-thin we need
> to update the header with a new object count.  That causes us to
> recompute the footer checksum for the entire pack, and the only
> way to do that is to re-read the data from disk.
> 
> If there was filesystem corruption in the process (e.g. a bad
> disk sector, or a kernel bug) we don't want to produce a valid
> pack at the end.  Instead we need to fail-fast with the error
> so the user is aware of the corruption.
> 
> We now keep track of where the end of the original data is and
> run two SHA-1 computations during the header-footer fixup.  If
> the original data region doesn't match the original footer we
> got over the network we know there was corruption and we just
> cannot trust this pack file.
> 
> Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
> ---
> 
>   This was inspired by the data corruption thread started
>   by J. Bruce Fields.  At some point in the thread Linus
>   pointed out the C Git index-pack isn't as safe as it can
>   be, and offered a strategy to fix it.

I thought it was Nicolas Pitre who offered that strategy?
Maybe I was mistaken.  ;-)


Nicolas

  parent reply	other threads:[~2008-08-28  0:11 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-27 21:48 [JGIT PATCH 1/2] index-pack: Avoid disk corruption yielding a valid pack footer checksum Shawn O. Pearce
2008-08-27 21:48 ` [JGIT PATCH 2/2] index-pack: Use fsync to ensure received pack data is on disk Shawn O. Pearce
2008-08-28  0:09 ` Nicolas Pitre [this message]
2008-08-28  0:14   ` [JGIT PATCH 1/2] index-pack: Avoid disk corruption yielding a valid pack footer checksum Shawn O. Pearce
2008-08-28  0:26     ` Nicolas Pitre

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=alpine.LFD.1.10.0808272007541.1624@xanadu.home \
    --to=nico@cam.org \
    --cc=git@vger.kernel.org \
    --cc=robin.rosenberg@dewire.com \
    --cc=spearce@spearce.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).