From: Jeff King <peff@peff.net>
To: David Turner <novalis@novalis.org>
Cc: "Martin Ågren" <martin.agren@gmail.com>,
"Git Mailing List" <git@vger.kernel.org>
Subject: Re: [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()`
Date: Tue, 8 May 2018 14:08:41 -0400 [thread overview]
Message-ID: <20180508180840.GA7210@sigill.intra.peff.net> (raw)
In-Reply-To: <01AF002E-C9E2-48FB-97AB-D9D903866310@novalis.org>
On Mon, May 07, 2018 at 05:12:27AM -0600, David Turner wrote:
> >Right. After commit 076aa2cbda (tempfile: auto-allocate tempfiles on
> >heap, 2017-09-05) this is safe though. Quite a few locks have already
> >been moved to the stack, e.g., in 14bca6c63c (sequencer: make lockfiles
> >non-static, 2018-02-27) and 02ae242fdd (checkout-index: simplify
> >locking
> >logic, 2017-10-05). I could add a note to the commit message to make
> >this clear, like "After 076aa2cbda, locks no longer need to be static."
>
> I am going to reply now to keep the thread moving, but I am on my
> phone with bad connectivity (few cell towers in Bears Ears), so I
> can't really check the code. Feel free to disregard if I am still
> wrong.
>
> I saw that patch, but I thought the new logic required that cleanup
> funtions be called before the lock goes out of scope.
No, it should be fine. After 422a21c6a0 (tempfile: remove deactivated
list entries, 2017-09-05) it became _possible_ to use a non-static
tempfile. But it was dangerous, because if you failed to clean up, bad
things would happen. So right after that in 076aa2cbda we switched to
using the heap, which means the tempfile code takes full ownership, and
the local lockfile variable is just a pointer to that storage.
-Peff
next prev parent reply other threads:[~2018-05-08 18:08 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-06 14:10 [PATCH 2/5] refs.c: do not die if locking fails in `write_pseudoref()` Martin Ågren
2018-05-06 15:48 ` David Turner
2018-05-06 15:56 ` Martin Ågren
2018-05-07 11:12 ` David Turner
2018-05-08 18:08 ` Jeff King [this message]
2018-05-07 18:48 ` Stefan Beller
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=20180508180840.GA7210@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.com \
--cc=novalis@novalis.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).