git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>, "Jeff King" <peff@peff.net>,
	"Han-Wen Nienhuys" <hanwen@google.com>,
	"Michael Haggerty" <mhagger@alum.mit.edu>,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH v5 00/13] fix "git reflog expire" race & get rid of EISDIR in refs API
Date: Mon, 23 Aug 2021 13:36:01 +0200	[thread overview]
Message-ID: <cover-v5-00.13-00000000000-20210823T113115Z-avarab@gmail.com> (raw)
In-Reply-To: <cover-00.11-0000000000-20210726T234237Z-avarab@gmail.com>

A re-roll of
https://lore.kernel.org/git/cover-00.11-0000000000-20210726T234237Z-avarab@gmail.com

This incorporates Jeff King's
https://lore.kernel.org/git/YQyGe9qOPRA0nf5v@coredump.intra.peff.net;
so this replaces ab/refs-files-cleanup and
jk/refs-files-cleanup-cleanup.

There's also a trivial commit message grammar fix here that Junio
already squashed into his version of v4. The rest of the changes are
all due to the rebase on Jeff's commit to get rid of the "flags"
parameter.

But most importantly there's a new "refs API: remove OID argument to
reflog_expire()" patch here, to change the function signature of
reflog_expire() to not pass the OID. Leaving it in place caused a
segfault in the reftable topic, now it just won't compile in
combination with this. I'm submitting update(s) to those other topics
on top to make these all work nicely together.

Jeff King (1):
  refs: drop unused "flags" parameter to lock_ref_oid_basic()

Ævar Arnfjörð Bjarmason (12):
  refs/packet: add missing BUG() invocations to reflog callbacks
  refs/files: remove unused REF_DELETING in lock_ref_oid_basic()
  refs/files: remove unused "extras/skip" in lock_ref_oid_basic()
  refs/files: remove unused "skip" in lock_raw_ref() too
  refs/debug: re-indent argument list for "prepare"
  refs: make repo_dwim_log() accept a NULL oid
  refs/files: add a comment about refs_reflog_exists() call
  reflog expire: don't lock reflogs using previously seen OID
  refs API: remove OID argument to reflog_expire()
  refs/files: remove unused "oid" in lock_ref_oid_basic()
  refs/files: remove unused "errno == EISDIR" code
  refs/files: remove unused "errno != ENOTDIR" condition

 builtin/reflog.c      |  13 ++---
 reflog-walk.c         |   3 +-
 refs.c                |  13 +++--
 refs.h                |   9 ++-
 refs/debug.c          |   8 +--
 refs/files-backend.c  | 132 +++++++++++-------------------------------
 refs/packed-backend.c |   7 ++-
 refs/refs-internal.h  |   2 +-
 8 files changed, 64 insertions(+), 123 deletions(-)

Range-diff against v4:
 1:  92fc3af0727 =  1:  61cf49b9582 refs/packet: add missing BUG() invocations to reflog callbacks
 2:  67cd2331fb4 !  2:  a20548c1a4d refs/files: remove unused REF_DELETING in lock_ref_oid_basic()
    @@ Metadata
      ## Commit message ##
         refs/files: remove unused REF_DELETING in lock_ref_oid_basic()
     
    -    The lock_ref_oid_basic() function has gradually been by most callers
    -    no longer performing a low-level "acquire lock, update and release",
    -    and instead using the ref transaction API. So there are only 4
    -    remaining callers of lock_ref_oid_basic().
    +    The lock_ref_oid_basic() function has gradually been replaced by
    +    most callers no longer performing a low-level "acquire lock,
    +    update and release", and instead using the ref transaction API.
    +    So there are only 4 remaining callers of lock_ref_oid_basic().
     
         None of those callers pass REF_DELETING anymore, the last caller went
         away in 92b1551b1d (refs: resolve symbolic refs first,
 -:  ----------- >  3:  d3216a6b1d8 refs: drop unused "flags" parameter to lock_ref_oid_basic()
 3:  7d76514b559 !  4:  3e538eb3008 refs/files: remove unused "extras/skip" in lock_ref_oid_basic()
    @@ refs/files-backend.c: static int create_reflock(const char *path, void *cb)
      					   const struct object_id *old_oid,
     -					   const struct string_list *extras,
     -					   const struct string_list *skip,
    - 					   unsigned int flags, int *type,
    - 					   struct strbuf *err)
    + 					   int *type, struct strbuf *err)
      {
    + 	struct strbuf ref_file = STRBUF_INIT;
     @@ refs/files-backend.c: static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
      			last_errno = errno;
      			if (!refs_verify_refname_available(
    @@ refs/files-backend.c: static int files_copy_or_rename_ref(struct ref_store *ref_
      
      	logmoved = log;
      
    +-
     -	lock = lock_ref_oid_basic(refs, newrefname, NULL, NULL, NULL,
    --				  REF_NO_DEREF, NULL, &err);
    -+	lock = lock_ref_oid_basic(refs, newrefname, NULL, REF_NO_DEREF, NULL,
    -+				  &err);
    +-				  NULL, &err);
    ++	lock = lock_ref_oid_basic(refs, newrefname, NULL, NULL, &err);
      	if (!lock) {
      		if (copy)
      			error("unable to copy '%s' to '%s': %s", oldrefname, newrefname, err.buf);
    @@ refs/files-backend.c: static int files_copy_or_rename_ref(struct ref_store *ref_
      
       rollback:
     -	lock = lock_ref_oid_basic(refs, oldrefname, NULL, NULL, NULL,
    -+	lock = lock_ref_oid_basic(refs, oldrefname, NULL,
    - 				  REF_NO_DEREF, NULL, &err);
    +-				  NULL, &err);
    ++	lock = lock_ref_oid_basic(refs, oldrefname, NULL, NULL, &err);
      	if (!lock) {
      		error("unable to lock %s for rollback: %s", oldrefname, err.buf);
    + 		strbuf_release(&err);
     @@ refs/files-backend.c: static int files_create_symref(struct ref_store *ref_store,
    + 	struct ref_lock *lock;
      	int ret;
      
    - 	lock = lock_ref_oid_basic(refs, refname, NULL,
    --				  NULL, NULL, REF_NO_DEREF, NULL,
    -+				  REF_NO_DEREF, NULL,
    - 				  &err);
    +-	lock = lock_ref_oid_basic(refs, refname, NULL,
    +-				  NULL, NULL, NULL,
    +-				  &err);
    ++	lock = lock_ref_oid_basic(refs, refname, NULL, NULL, &err);
      	if (!lock) {
      		error("%s", err.buf);
    + 		strbuf_release(&err);
     @@ refs/files-backend.c: static int files_reflog_expire(struct ref_store *ref_store,
    + 	 * reference itself, plus we might need to update the
      	 * reference if --updateref was specified:
      	 */
    - 	lock = lock_ref_oid_basic(refs, refname, oid,
    --				  NULL, NULL, REF_NO_DEREF,
    -+				  REF_NO_DEREF,
    - 				  &type, &err);
    +-	lock = lock_ref_oid_basic(refs, refname, oid,
    +-				  NULL, NULL, &type, &err);
    ++	lock = lock_ref_oid_basic(refs, refname, oid, &type, &err);
      	if (!lock) {
      		error("cannot lock ref '%s': %s", refname, err.buf);
    + 		strbuf_release(&err);
 4:  852f86e666f =  5:  b7335e79f8b refs/files: remove unused "skip" in lock_raw_ref() too
 5:  685b48328af =  6:  24449766060 refs/debug: re-indent argument list for "prepare"
 6:  b75e7673d70 =  7:  3b7daf03e5a refs: make repo_dwim_log() accept a NULL oid
 7:  7fe6c9bd921 =  8:  51abe459e70 refs/files: add a comment about refs_reflog_exists() call
 8:  c9c2da35997 !  9:  aba12606cea reflog expire: don't lock reflogs using previously seen OID
    @@ refs/files-backend.c: static int files_reflog_expire(struct ref_store *ref_store
      	 * reference itself, plus we might need to update the
      	 * reference if --updateref was specified:
      	 */
    --	lock = lock_ref_oid_basic(refs, refname, oid,
    -+	lock = lock_ref_oid_basic(refs, refname, NULL,
    - 				  REF_NO_DEREF,
    - 				  &type, &err);
    +-	lock = lock_ref_oid_basic(refs, refname, oid, &type, &err);
    ++	lock = lock_ref_oid_basic(refs, refname, NULL, &type, &err);
      	if (!lock) {
    -@@ refs/files-backend.c: static int files_reflog_expire(struct ref_store *ref_store,
    + 		error("cannot lock ref '%s': %s", refname, err.buf);
      		strbuf_release(&err);
      		return -1;
      	}
 -:  ----------- > 10:  5afa8f1be29 refs API: remove OID argument to reflog_expire()
 9:  b61c734cf5c ! 11:  7712e29abe6 refs/files: remove unused "oid" in lock_ref_oid_basic()
    @@ refs/files-backend.c: static struct ref_iterator *files_ref_iterator_begin(
      {
      	/*
     @@ refs/files-backend.c: static int create_reflock(const char *path, void *cb)
    +  * On failure errno is set to something meaningful.
       */
      static struct ref_lock *lock_ref_oid_basic(struct files_ref_store *refs,
    - 					   const char *refname,
    +-					   const char *refname,
     -					   const struct object_id *old_oid,
    - 					   unsigned int flags, int *type,
    - 					   struct strbuf *err)
    +-					   int *type, struct strbuf *err)
    ++					   const char *refname, int *type,
    ++					   struct strbuf *err)
      {
      	struct strbuf ref_file = STRBUF_INIT;
      	struct ref_lock *lock;
    @@ refs/files-backend.c: static int files_copy_or_rename_ref(struct ref_store *ref_
      
      	logmoved = log;
      
    --	lock = lock_ref_oid_basic(refs, newrefname, NULL, REF_NO_DEREF, NULL,
    --				  &err);
    -+	lock = lock_ref_oid_basic(refs, newrefname, REF_NO_DEREF, NULL, &err);
    +-	lock = lock_ref_oid_basic(refs, newrefname, NULL, NULL, &err);
    ++	lock = lock_ref_oid_basic(refs, newrefname, NULL, &err);
      	if (!lock) {
      		if (copy)
      			error("unable to copy '%s' to '%s': %s", oldrefname, newrefname, err.buf);
    @@ refs/files-backend.c: static int files_copy_or_rename_ref(struct ref_store *ref_
      	goto out;
      
       rollback:
    --	lock = lock_ref_oid_basic(refs, oldrefname, NULL,
    --				  REF_NO_DEREF, NULL, &err);
    -+	lock = lock_ref_oid_basic(refs, oldrefname, REF_NO_DEREF, NULL, &err);
    +-	lock = lock_ref_oid_basic(refs, oldrefname, NULL, NULL, &err);
    ++	lock = lock_ref_oid_basic(refs, oldrefname, NULL, &err);
      	if (!lock) {
      		error("unable to lock %s for rollback: %s", oldrefname, err.buf);
      		strbuf_release(&err);
    @@ refs/files-backend.c: static int files_create_symref(struct ref_store *ref_store
      	struct ref_lock *lock;
      	int ret;
      
    --	lock = lock_ref_oid_basic(refs, refname, NULL,
    --				  REF_NO_DEREF, NULL,
    --				  &err);
    -+	lock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, NULL, &err);
    +-	lock = lock_ref_oid_basic(refs, refname, NULL, NULL, &err);
    ++	lock = lock_ref_oid_basic(refs, refname, NULL, &err);
      	if (!lock) {
      		error("%s", err.buf);
      		strbuf_release(&err);
    @@ refs/files-backend.c: static int files_reflog_expire(struct ref_store *ref_store
      	 * reference itself, plus we might need to update the
      	 * reference if --updateref was specified:
      	 */
    --	lock = lock_ref_oid_basic(refs, refname, NULL,
    --				  REF_NO_DEREF,
    --				  &type, &err);
    -+	lock = lock_ref_oid_basic(refs, refname, REF_NO_DEREF, &type, &err);
    +-	lock = lock_ref_oid_basic(refs, refname, NULL, &type, &err);
    ++	lock = lock_ref_oid_basic(refs, refname, &type, &err);
      	if (!lock) {
      		error("cannot lock ref '%s': %s", refname, err.buf);
      		strbuf_release(&err);
10:  009abc99688 = 12:  f746939a27a refs/files: remove unused "errno == EISDIR" code
11:  acb131cc1c5 = 13:  2e30ee04edb refs/files: remove unused "errno != ENOTDIR" condition
-- 
2.33.0.662.g438caf9576d


  parent reply	other threads:[~2021-08-23 11:37 UTC|newest]

Thread overview: 88+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-14 11:17 [PATCH] refs file backend: remove dead "errno == EISDIR" code Ævar Arnfjörð Bjarmason
2021-07-14 16:21 ` Jeff King
2021-07-14 19:07   ` Ævar Arnfjörð Bjarmason
2021-07-14 23:15     ` Jeff King
2021-07-15  0:02       ` Ævar Arnfjörð Bjarmason
2021-07-15  5:16         ` Jeff King
2021-07-17  1:28           ` Junio C Hamano
2021-07-17  2:33             ` Jeff King
2021-07-19 15:42               ` Junio C Hamano
2021-07-19 16:59                 ` Junio C Hamano
2021-07-17 21:36             ` Ævar Arnfjörð Bjarmason
2021-07-16 14:12 ` [PATCH v2 00/11] fix "git reflog expire" race & get rid of EISDIR in refs API Ævar Arnfjörð Bjarmason
2021-07-16 14:12   ` [PATCH v2 01/11] refs/packet: add missing BUG() invocations to reflog callbacks Ævar Arnfjörð Bjarmason
2021-07-16 14:12   ` [PATCH v2 02/11] refs/files: remove unused REF_DELETING in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-07-17  2:03     ` Jeff King
2021-07-19 16:16     ` Junio C Hamano
2021-07-20  7:19       ` Jeff King
2021-07-16 14:12   ` [PATCH v2 03/11] refs/files: remove unused "extras/skip" " Ævar Arnfjörð Bjarmason
2021-07-16 14:13   ` [PATCH v2 04/11] refs/files: remove unused "skip" in lock_raw_ref() too Ævar Arnfjörð Bjarmason
2021-07-16 14:13   ` [PATCH v2 05/11] refs/debug: re-indent argument list for "prepare" Ævar Arnfjörð Bjarmason
2021-07-16 14:13   ` [PATCH v2 06/11] refs API: pass the "lock OID" to reflog "prepare" Ævar Arnfjörð Bjarmason
2021-07-17  2:04     ` Jeff King
2021-07-19 16:30     ` Junio C Hamano
2021-07-19 19:21       ` Ævar Arnfjörð Bjarmason
2021-07-16 14:13   ` [PATCH v2 07/11] refs: make repo_dwim_log() accept a NULL oid Ævar Arnfjörð Bjarmason
2021-07-16 14:13   ` [PATCH v2 08/11] refs/files: add a comment about refs_reflog_exists() call Ævar Arnfjörð Bjarmason
2021-07-17  2:08     ` Jeff King
2021-07-19 16:43       ` Junio C Hamano
2021-07-20  7:22         ` Jeff King
2021-07-16 14:13   ` [PATCH v2 09/11] reflog expire: don't lock reflogs using previously seen OID Ævar Arnfjörð Bjarmason
2021-07-17  2:23     ` Jeff King
2021-08-17 13:35     ` Han-Wen Nienhuys
2021-08-18 21:05       ` Junio C Hamano
2021-08-19 10:06         ` Carlo Marcelo Arenas Belón
2021-08-20  2:30           ` Junio C Hamano
2021-07-16 14:13   ` [PATCH v2 10/11] refs/files: remove unused "oid" in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-07-17  2:26     ` Jeff King
2021-07-16 14:13   ` [PATCH v2 11/11] refs/files: remove unused "errno == EISDIR" code Ævar Arnfjörð Bjarmason
2021-07-17  2:30     ` Jeff King
2021-07-17  2:34   ` [PATCH v2 00/11] fix "git reflog expire" race & get rid of EISDIR in refs API Jeff King
2021-07-20 10:24   ` [PATCH v3 00/12] " Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 01/12] refs/packet: add missing BUG() invocations to reflog callbacks Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 02/12] refs/files: remove unused REF_DELETING in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-08-02 17:17       ` Junio C Hamano
2021-07-20 10:24     ` [PATCH v3 03/12] refs/files: remove unused "extras/skip" " Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 04/12] refs/files: remove unused "skip" in lock_raw_ref() too Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 05/12] refs/debug: re-indent argument list for "prepare" Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 06/12] refs API: pass the "lock OID" to reflog "prepare" Ævar Arnfjörð Bjarmason
2021-07-21 17:40       ` Junio C Hamano
2021-07-21 17:47         ` Junio C Hamano
     [not found]           ` <CAFQ2z_PuNJ_KtS_O9R2s0jdGbNNKnKdS3=_-nEu6367pteCxwA@mail.gmail.com>
2021-07-23 19:41             ` Ævar Arnfjörð Bjarmason
2021-07-23 20:49               ` Junio C Hamano
2021-07-26  5:39                 ` Ævar Arnfjörð Bjarmason
2021-07-26 17:47                   ` Junio C Hamano
2021-07-20 10:24     ` [PATCH v3 07/12] refs: make repo_dwim_log() accept a NULL oid Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 08/12] refs/files: add a comment about refs_reflog_exists() call Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 09/12] reflog expire: don't lock reflogs using previously seen OID Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 10/12] refs/files: remove unused "oid" in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 11/12] refs/files: remove unused "errno == EISDIR" code Ævar Arnfjörð Bjarmason
2021-07-20 10:24     ` [PATCH v3 12/12] refs/files: remove unused "errno != ENOTDIR" condition Ævar Arnfjörð Bjarmason
2021-07-26 23:44     ` [PATCH v4 00/11] fix "git reflog expire" race & get rid of EISDIR in refs API Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 01/11] refs/packet: add missing BUG() invocations to reflog callbacks Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 02/11] refs/files: remove unused REF_DELETING in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 03/11] refs/files: remove unused "extras/skip" " Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 04/11] refs/files: remove unused "skip" in lock_raw_ref() too Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 05/11] refs/debug: re-indent argument list for "prepare" Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 06/11] refs: make repo_dwim_log() accept a NULL oid Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 07/11] refs/files: add a comment about refs_reflog_exists() call Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 08/11] reflog expire: don't lock reflogs using previously seen OID Ævar Arnfjörð Bjarmason
2021-08-02 17:26         ` Junio C Hamano
2021-08-04  9:56           ` Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 09/11] refs/files: remove unused "oid" in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 10/11] refs/files: remove unused "errno == EISDIR" code Ævar Arnfjörð Bjarmason
2021-07-26 23:44       ` [PATCH v4 11/11] refs/files: remove unused "errno != ENOTDIR" condition Ævar Arnfjörð Bjarmason
2021-08-23 11:36       ` Ævar Arnfjörð Bjarmason [this message]
2021-08-23 11:36         ` [PATCH v5 01/13] refs/packet: add missing BUG() invocations to reflog callbacks Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 02/13] refs/files: remove unused REF_DELETING in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 03/13] refs: drop unused "flags" parameter to lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 04/13] refs/files: remove unused "extras/skip" in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 05/13] refs/files: remove unused "skip" in lock_raw_ref() too Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 06/13] refs/debug: re-indent argument list for "prepare" Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 07/13] refs: make repo_dwim_log() accept a NULL oid Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 08/13] refs/files: add a comment about refs_reflog_exists() call Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 09/13] reflog expire: don't lock reflogs using previously seen OID Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 10/13] refs API: remove OID argument to reflog_expire() Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 11/13] refs/files: remove unused "oid" in lock_ref_oid_basic() Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 12/13] refs/files: remove unused "errno == EISDIR" code Ævar Arnfjörð Bjarmason
2021-08-23 11:36         ` [PATCH v5 13/13] refs/files: remove unused "errno != ENOTDIR" condition Ævar Arnfjörð Bjarmason

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=cover-v5-00.13-00000000000-20210823T113115Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=hanwen@google.com \
    --cc=mhagger@alum.mit.edu \
    --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.
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).