Re: [RFC PATCH 1/2] sha1-file: fsync() loose dir entry when core.fsyncObjectFiles
- From
Jeff King <peff@peff.net>
- Date
- Sep 17, 2020, 14:55 UTC
- Message-ID
- <20200917145523.GB3076467@coredump.intra.peff.net>
- In-Reply-To
- <20200917140912.GA27653@lst.de>
On Thu, Sep 17, 2020 at 04:09:12PM +0200, Christoph Hellwig wrote:
Show 9 quoted lines
> On Thu, Sep 17, 2020 at 01:28:29PM +0200, Ævar Arnfjörð Bjarmason wrote: > > Change the behavior of core.fsyncObjectFiles to also sync the > > directory entry. I don't have a case where this broke, just going by > > paranoia and the fsync(2) manual page's guarantees about its behavior. > > It is not just paranoia, but indeed what is required from the standards > POV. At least for many Linux file systems your second fsync will be > very cheap (basically a NULL syscall) as the log has alredy been forced > all the way by the first one, but you can't rely on that.
Is it sufficient to fsync() just the surrounding directory? I.e., if I do:
mkdir("a");
mkdir("a/b");
open("a/b/c", O_WRONLY);is it enough to fsync() a descriptor pointing to "a/b", or should I also do "a"?
-Peff