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

Re: Lockless Refs? (Was [PATCH] refs: do not use cached refs in repack_without_ref)

From
DNDrew Northup <n1xim.email@gmail.com>
Date
Jan 22, 2013, 04:31 UTC
Message-ID
<CAM9Z-nmJb3LGO3wLxPYhwc+7Cyw7J8q1E_PppNYQSmXKQ2ieQQ@mail.gmail.com>
In-Reply-To
<20130105161215.GA24900@sigill.intra.peff.net>
On Sat, Jan 5, 2013 at 11:12 AM, Jeff King <peff@peff.net> wrote:
Show 13 quoted lines
> On Mon, Dec 31, 2012 at 03:30:53AM -0700, Martin Fick wrote:
>
>> The general approach is to setup a transaction and either
>> commit or abort it.  A transaction can be setup by renaming
>> an appropriately setup directory to the "ref.lock" name.  If
>> the rename succeeds, the transaction is begun.  Any actor can
>> abort the transaction (up until it is committed) by simply
>> deleting the "ref.lock" directory, so it is not at risk of
>> going stale.
>
> Deleting a directory is not atomic, as you first have to remove the
> contents, putting it into a potentially inconsistent state. I'll assume
> you deal with that later...

I know I'm a bit late to the dance here, but FWIW the apparent atomicy (odd conjugation there) of directory deletion depends largely upon the filesystem and VFS api in use. It is not unheard of that a delete operation actually consist of moving the reference to the item's own allocation marker into a "trashcan" to be cleaned up after later. In other words, I'd not advise planning on directory deletes always being atomic nor always not being atomic.

-- 
-Drew Northup
--------------------------------------------------------------
"As opposed to vegetable or mineral error?"
-John Pescatore, SANS NewsBites Vol. 12 Num. 59
Previous: Jeff KingNext: Jeff King
Message 21 of 23 in “refs: do not use cached refs in repack_without_ref”
  1. refs: do not use cached refs in repack_without_refJeff King, Dec 21, 2012
  2. Michael HaggertyDec 26, 2012
  3. Lockless Refs? (Was [PATCH] refs: do not use cached refs in repack_without_ref)Martin Fick, Dec 27, 2012
  4. Martin FickDec 28, 2012
  5. Junio C HamanoDec 28, 2012
  6. Jeff KingDec 29, 2012
  7. Martin FickDec 29, 2012
  8. Jeff KingDec 29, 2012
  9. Martin FickDec 29, 2012
  10. Junio C HamanoDec 28, 2012
  11. Martin FickDec 29, 2012
  12. Jeff KingDec 29, 2012
  13. Martin FickDec 29, 2012
  14. Martin FickDec 30, 2012
  15. Martin FickDec 31, 2012
  16. Martin FickJan 3, 2013
  17. Pyeron, Jason J CTR (US)Jan 4, 2013
  18. Martin FickJan 4, 2013
  19. Junio C HamanoJan 4, 2013
  20. Jeff KingJan 5, 2013
  21. Drew NorthupJan 22, 2013
  22. Jeff KingDec 29, 2012
  23. Martin FickJan 7, 2013

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.