git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Jeff King <peff@peff.net>
To: Michael Haggerty <mhagger@alum.mit.edu>
Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
Subject: Re: v2.15.0-rc2 ref deletion bug
Date: Tue, 24 Oct 2017 12:04:11 -0700	[thread overview]
Message-ID: <20171024190411.dvv7zsq6ax4nndti@sigill.intra.peff.net> (raw)
In-Reply-To: <ea715dae-b410-d4fb-77c7-2e61b764a343@alum.mit.edu>

On Tue, Oct 24, 2017 at 01:05:00PM +0200, Michael Haggerty wrote:

> > I'd expect one of:
> > 
> >   1. We delete "foo" before updating "foo/bar", and we end up with a
> >      single ref.
> 
> I don't think that this is possible in the general case in a single
> transaction. The problem is that the code would need to take locks
> 
>     refs/tags/foo.lock
>     refs/tags/foo/bar.lock
> 
> But the latter couldn't coexist with the loose reference file
> 
>     refs/tags/foo
> 
> , which might already exist.

Yeah, you're right. I was thinking of the opposite case (where you
could create "foo.lock" even though "foo/bar" exists), but this one is
impossible with filesystem semantics.

> It is only imaginable to do this in a single transaction if you pack and
> prune `refs/tags/foo` first, to get the loose reference out of the way,
> before executing the transaction. Even then, you would have to beware of
> a race where another process writes a loose version of `refs/tags/foo`
> between the time that `pack-refs` prunes it and the time that the
> transaction obtains the lock again.

Yeah, it's probably better to avoid playing games here. Moving to a
non-filesystem storage backend would just make the problem go away.

-Peff

      parent reply	other threads:[~2017-10-24 19:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-24  8:24 v2.15.0-rc2 ref deletion bug Jeff King
2017-10-24 11:05 ` Michael Haggerty
2017-10-24 12:43   ` Michael Haggerty
2017-10-24 19:04   ` Jeff King [this message]

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

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171024190411.dvv7zsq6ax4nndti@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mhagger@alum.mit.edu \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).