All of lore.kernel.org
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Johan Herland <johan@herland.net>, Duy Nguyen <pclouds@gmail.com>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: [PATCH] sha1_file.c:create_tmpfile(): Fix race when creating loose object dirs
Date: Fri, 18 Oct 2013 12:24:55 -0700	[thread overview]
Message-ID: <xmqq7gdawfeg.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <20131018190537.GB11040@sigill.intra.peff.net> (Jeff King's message of "Fri, 18 Oct 2013 15:05:37 -0400")

Jeff King <peff@peff.net> writes:

> I was almost tempted to say "we do not even need to run
> adjust_shared_perm twice", but we do, or we risk another race: one side
> loses the mkdir race, but wins the open() race, and writes to a
> wrong-permission directory. Of course, that should not matter unless the
> racers are two different users (in a shared repo), and in that case, we
> wins the adjust_shared_perm race, but does not have permission to change
> the mode.

Interesting.

> Agreed. We already leave a wrong-permission directory in place if it
> existed before we started create_tmpfile. The code before your patch,
> when racing with such a wrong-directory creator, would abort the
> tmpfile. Now it will correct the permissions. Either behavior seems fine
> to me (yours actually seems better, but the point is that it does not
> matter because they are dwarfed by the non-race cases where the
> directory is already sitting there).

Agreed.  We may notice the failure to correct the permissions in the
new code, where the old code left existing directories incorrect
permissions as they were.

  reply	other threads:[~2013-10-18 19:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 13:17 [PATCH] sha1_file.c:create_tmpfile(): Fix race when creating loose object dirs Johan Herland
2013-10-18 13:53 ` Eric Sunshine
2013-10-18 14:52   ` Johan Herland
2013-10-18 15:58     ` Eric Sunshine
2013-10-18 13:55 ` Duy Nguyen
2013-10-18 14:00   ` Duy Nguyen
2013-10-18 15:41     ` Johan Herland
2013-10-18 19:05       ` Jeff King
2013-10-18 19:24         ` Junio C Hamano [this message]
2013-10-18 23:45           ` Johan Herland
2013-10-19  2:53             ` Jeff King
2013-10-22 18:09             ` Junio C Hamano

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=xmqq7gdawfeg.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=johan@herland.net \
    --cc=pclouds@gmail.com \
    --cc=peff@peff.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.