git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Matthieu Moy <Matthieu.Moy@grenoble-inp.fr>
Cc: Jan Smets <jan.smets@alcatel-lucent.com>, <git@vger.kernel.org>
Subject: Re: repository corruption when pushing commits to a repository running 'git gc --prune='
Date: Wed, 14 Oct 2015 13:05:36 -0700	[thread overview]
Message-ID: <xmqq7fmp8bcf.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <vpqbnc18ezo.fsf@grenoble-inp.fr> (Matthieu Moy's message of "Wed, 14 Oct 2015 20:46:51 +0200")

Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:

> This looks like a race between deleting objects/05/ and creating
> objects/05/cdb51bb0ea3e229734a4b1bddd5ec70fbc65ed.
>
> I don't understand how this is possible, since the temporary file and
> the final one are in the same directory, so deleting the directory
> should fail.
>
> What am I missing?

 1. tmp_obj_* gets created in objects/05/ by "git unpack-objects";

 2. prune_cruft() comes, notices tmp_obj_* that is sufficiently old,
    decides to remove in "git prune".

 3. prune_subdir() comes, notices objects/05/ is now empty, does
    rmdir().

 4. "git unpack-objects" closes the file whose inode was originally
    associated with the path objects/05/tmp_obj_*;

 5. "git unpack-objects" calls finalize_object_file() and tries to
    link(2) or rename(2) it to its final name.  It does not find the
    source of the link or rename and says "oops, no such file".

  reply	other threads:[~2015-10-14 20:05 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-14 13:44 repository corruption when pushing commits to a repository running 'git gc --prune=' Jan Smets
2015-10-14 14:38 ` Matthieu Moy
2015-10-14 17:37   ` Junio C Hamano
2015-10-14 18:40     ` Matthieu Moy
2015-10-14 20:48       ` Junio C Hamano
2015-10-14 21:09         ` Matthieu Moy
2015-10-14 21:39           ` Junio C Hamano
2015-10-14 18:46 ` Matthieu Moy
2015-10-14 20:05   ` Junio C Hamano [this message]
2015-10-14 20:08     ` Matthieu Moy

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=xmqq7fmp8bcf.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox.com \
    --cc=Matthieu.Moy@grenoble-inp.fr \
    --cc=git@vger.kernel.org \
    --cc=jan.smets@alcatel-lucent.com \
    /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).