From: Jeff King <peff@peff.net>
To: "Martin Ågren" <martin.agren@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 0/5] getting rid of most "static struct lock_file"s
Date: Tue, 8 May 2018 14:25:48 -0400 [thread overview]
Message-ID: <20180508182548.GD7210@sigill.intra.peff.net> (raw)
In-Reply-To: <20180506141031.30204-1-martin.agren@gmail.com>
On Sun, May 06, 2018 at 04:10:26PM +0200, Martin Ågren wrote:
> This series addresses two classes of "static struct lock_file", removing
> the staticness: Those locks that already live inside a function, and
> those that can simply be moved into the function they are used from.
>
> The first three patches are some cleanups I noticed along the way, where
> we first take a lock using LOCK_DIE_ON_ERROR, then check whether we got
> it.
>
> After this series, we have a small number of "static struct lock_file"
> left, namely those locks that are used from within more than one
> function. Thus, after this series, when one stumbles upon a static
> lock_file, it should be a clear warning that the lock is being
> used by more than one function.
These all look fine to me. The commit messages all made perfect sense to
me, but it sounds like some people weren't aware of the new
post-076aa2cbda rules. So maybe it makes sense to reference that even in
the earlier commits, and to explicitly say that it's safe to convert
even in the case where the lock_file goes out of scope while still
active.
The only dangerous thing left to check for is anybody holding onto a
pointer-to-lockfile. The only such pointer declared outside of a
parameter list is in create_reflock(), and there it's just to
temporarily coerce a void pointer. So unless somebody is doing something
really tricky (putting a pointer-to-lock in a "void *"), I think these
conversions all have to be trivially correct (famous last words...).
-Peff
next prev parent reply other threads:[~2018-05-08 18:25 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-06 14:10 [PATCH 0/5] getting rid of most "static struct lock_file"s Martin Ågren
2018-05-08 18:25 ` Jeff King [this message]
2018-05-09 20:55 ` [PATCH v2 " Martin Ågren
2018-05-09 20:55 ` [PATCH v2 1/5] t/helper/test-write-cache: clean up lock-handling Martin Ågren
2018-05-09 20:55 ` [PATCH v2 2/5] refs.c: do not die if locking fails in `write_pseudoref()` Martin Ågren
2018-05-09 20:55 ` [PATCH v2 3/5] refs.c: do not die if locking fails in `delete_pseudoref()` Martin Ågren
2018-05-09 20:55 ` [PATCH v2 4/5] lock_file: make function-local locks non-static Martin Ågren
2018-05-09 20:55 ` [PATCH v2 5/5] lock_file: move static locks into functions Martin Ågren
2018-05-10 5:21 ` [PATCH v2 0/5] getting rid of most "static struct lock_file"s Jeff King
2018-05-10 6:01 ` Junio C Hamano
2018-05-10 7:47 ` Martin Ågren
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=20180508182548.GD7210@sigill.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=martin.agren@gmail.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).