Subject: [PATCH v2 00/12] Re: various lockfile-leaks and -fixes

From: Martin Ågren <[email-masked]>
Date: Thu, 5 Oct 2017 22:32:02 +0200

On 3 October 2017 at 08:21, Junio C Hamano <[email-masked]> wrote:
> Martin Ågren <[email-masked]> writes:
>> On 2 October 2017 at 08:30, Junio C Hamano <[email-masked]> wrote:
>>
>> Thanks both of you for your comments. Based on them, I have made the
>> following notes:
>> ...
>> Especially 9-11 make me feel like wanting to re-roll this, for future
>> readers if nothing else. I expect to be able to do so in the middle of
>> this week (I don't know how this interferes with Junio's definition of
>> "soonish").
>
> OK, then I'll hold off and expect such a reroll.

Here it is. Several patches are unchanged (fetched from Junio's tree and
reposted). There are two new patches (5, 12) to address some similar or
related issues noticed by Peff and Junio.

I think this got better by getting rid of `CLOSE_LOCK` entirely instead
of playing with `HAS_SINGLE_BIT()`. Patch 11 also improved IMHO by
squashing patches 10-11 of v1 and presenting the issues a bit
differently in the commit message. Thanks for your feedback, both of
you.

Martin

Martin Ågren (12):
  sha1_file: do not leak `lock_file`
  treewide: prefer lockfiles on the stack
  lockfile: fix documentation on `close_lock_file_gently()`
  tempfile: fix documentation on `delete_tempfile()`
  checkout-index: simplify locking logic
  cache-tree: simplify locking logic
  apply: move lockfile into `apply_state`
  apply: remove `newfd` from `struct apply_state`
  cache.h: document `write_locked_index()`
  read-cache: drop explicit `CLOSE_LOCK`-flag
  read-cache: leave lock in right state in `write_locked_index()`
  read_cache: roll back lock in `update_index_if_able()`

 apply.c                  | 25 ++++++++-----------------
 apply.h                  |  8 +++-----
 builtin/am.c             | 27 ++++++++++++---------------
 builtin/apply.c          |  4 +---
 builtin/checkout-index.c |  8 +++-----
 builtin/checkout.c       | 14 ++++++--------
 builtin/clone.c          |  7 +++----
 builtin/commit.c         | 10 +++++-----
 builtin/diff.c           |  7 +++----
 builtin/difftool.c       |  1 -
 cache-tree.c             | 12 ++++--------
 cache.h                  | 25 ++++++++++++++++++++++++-
 config.c                 | 17 ++++++++---------
 lockfile.h               |  4 ++--
 merge-recursive.c        |  6 +++---
 merge.c                  |  8 +++-----
 read-cache.c             | 28 ++++++++++++++--------------
 sequencer.c              |  1 -
 sha1_file.c              | 19 ++++++++-----------
 tempfile.h               |  8 ++++----
 wt-status.c              |  8 ++++----
 21 files changed, 118 insertions(+), 129 deletions(-)

-- 
2.14.2.666.gea220ee40