On Sat, Jan 5, 2013 at 11:12 AM, Jeff King <peff@xxxxxxxx> wrote: > 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 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html