From: Junio C Hamano Date: Thu, 18 Feb 2016 22:17:58 GMT Subject: Re: [PATCH 08/20] log_ref_setup(): improve robustness against races Message-ID: In-Reply-To: <9cee9cea6d284315f9a30e925dd0057bddc77c82.1455626201.git.mhagger@alum.mit.edu> Michael Haggerty writes: > Change log_ref_setup() to use raceproof_create_file() to create the new > logfile. This makes it more robust against a race against another > process that might be trying to clean up empty directories while we are > trying to create a new logfile. > > This also means that it will only call create_leading_directories() if > open() fails, which should be a net win. Even in the cases where we are > willing to create a new logfile, it will usually be the case that the > logfile already exists, or if not then that the directory containing the > logfile already exists. In such cases, we will save some work that was > previously done unconditionally. Makes sense.