git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: [PATCH 0/4] Always release pack files before calling gc --auto
Date: Wed, 13 Jan 2016 12:52:38 -0500	[thread overview]
Message-ID: <20160113175237.GA13139@sigill.intra.peff.net> (raw)
In-Reply-To: <cover.1452705584.git.johannes.schindelin@gmx.de>

On Wed, Jan 13, 2016 at 06:20:02PM +0100, Johannes Schindelin wrote:

> These patches are companions to 786b150 (clone --dissociate: avoid
> locking pack files, 2015-10-06), triggered by a bug report to the Git
> for Windows project.
> 
> Johannes Schindelin (4):
>   fetch: release pack files before garbage-collecting
>   am: release pack files before garbage-collecting
>   merge: release pack files before garbage-collecting
>   receive-pack: release pack files before garbage-collecting

I think this is fine, but I noticed an almost-problem that I think is
worth mentioning.

Closing packs can open up race conditions in some cases. I.e., we think
we have an object in a particular pack, do some work on that basis, and
then later find the pack to be inaccessible (due to somebody else
running gc). If we keep the fd open, there's no race, but if we close
it, we can't reopen it.

I think all of the cases here are fine, for two reasons:

  1. The new closing is right before the program would exit anyway, so
     there's no interesting work left to do (and obviously that's where
     we generally want to call "gc --auto", too)

  2. This type of race might only be an issue for pack-objects (or at least that's
     the only place I've seen it).  Most normal read_sha1_file() callers
     will happily re-scan the pack directory for the new packs upon
     finding that the old pack went away. But pack-objects peeks in the
     packfiles a little more intimately, and will record the actual pack
     and offset (for delta reuse).

     It _might_ also be possible to trigger this race using bitmaps,
     which are also pretty intimate with the packfile code. I'm not
     sure.

So I think this series is OK.

-Peff

  parent reply	other threads:[~2016-01-13 17:52 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-13 17:20 [PATCH 0/4] Always release pack files before calling gc --auto Johannes Schindelin
2016-01-13 17:20 ` [PATCH 1/4] fetch: release pack files before garbage-collecting Johannes Schindelin
2016-01-13 17:20 ` [PATCH 2/4] am: " Johannes Schindelin
2016-01-13 17:20 ` [PATCH 3/4] merge: " Johannes Schindelin
2016-01-13 17:20 ` [PATCH 4/4] receive-pack: " Johannes Schindelin
2016-01-13 17:52 ` Jeff King [this message]
2016-01-13 18:52   ` [PATCH 0/4] Always release pack files before calling gc --auto Johannes Schindelin

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=20160113175237.GA13139@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=johannes.schindelin@gmx.de \
    /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).