git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] lockfile.c: schedule remove_lock_file only once.

From
SVSven Verdoolaege <skimo@kotnet.org>
Date
Jul 15, 2007, 08:35 UTC
Message-ID
<20070715083521.GB999MdfPADPa@greensroom.kotnet.org>
In-Reply-To
<7vabu0noxg.fsf@assigned-by-dhcp.cox.net>
On Fri, Jul 13, 2007 at 11:23:07AM -0700, Junio C Hamano wrote:
> The reason we do not use lk->next but instead check lk->on_list,
> and the reason why we do not remove the lock from the list, are
> described in 1084b845.
I'm afraid I'm still missing something:
1084b845 commit message:
    We cannot remove the list element in commit_lock_file(); if we
    are interrupted in the middle of list manipulation, the call to
    remove_lock_file_on_signal() will happen with a broken list
    structure pointed by lock_file_list, which would cause the cruft
    to remain, so not removing the list element is the right thing
    to do.  Instead we should be reusing the element already on the
    list.
We have a list
list--->A--->B--->C
and we overwrite one next pointer to remove an element, say B
list--->A-------->C
At what point is the list structure broken?

If you are worried that the interrupt could happen in the middle of writing the pointer (could it?), then shouldn't you worry about adding elements too?

skimo
Previous: Junio C Hamano
Message 3 of 3 in “lockfile.c: schedule remove_lock_file only once.”
  1. lockfile.c: schedule remove_lock_file only once.Sven Verdoolaege, Jul 13, 2007
  2. Junio C HamanoJul 13, 2007
  3. Sven VerdoolaegeJul 15, 2007

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.