After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 728065 - investigate syncfs()
investigate syncfs()
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2014-04-11 22:46 UTC by Colin Walters
Modified: 2015-04-30 20:56 UTC
See Also:
GNOME target: ---
GNOME version: ---



Comment 1 Colin Walters 2015-01-06 21:26:29 UTC
So our aggressive use of fsync() is unwarranted; the bug turned out to 
be

https://bugzilla.redhat.com/show_bug.cgi?id=1099237

I think the simplest plan is to instead of calling fsync(), keep track of the filesystems we're writing to (ordinarily, just /boot and /).  Then just syncfs() them in the same place we're calling sync() right now.
Comment 2 Colin Walters 2015-01-21 13:54:20 UTC
There's two places where we fdatasync() - pulling objects, and during the checkout.

I think we could use syncfs() by default for pulls with a scheme like this:
- Anything stored in objects/ is known to be fdatasync()d
- During pull, we leave objects in tmp/, and don't fsync them.
- When pull for an object is complete, rename them to tmpobject-$checksum.$type, leaving them in the tmpdir.
- This means that for metadata, we will have to change the load_object() calls inside pull to look for temporary objects as well
- When pull is complete, we syncfs() and renameat() all of the temporary objects into place


Then the next phase is checkouts.  Where we do what I was describing in comment #1.

We could optimize a pull-deploy phase by only doing exactly one syncfs(), and renaming all of the objects into place after that.
Comment 3 Giuseppe Scrivano 2015-01-22 11:33:02 UTC
I've implemented this logic here:

https://github.com/giuseppe/ostree/commit/b13e13babda9a83309e1435554dff82636304df6
Comment 4 Giuseppe Scrivano 2015-03-16 15:41:11 UTC
can this be closed?
Comment 5 Colin Walters 2015-04-12 13:43:49 UTC
Yep, we can close this now I think.
Comment 6 Colin Walters 2015-04-30 20:56:33 UTC
Note there is some work on an XFS "fsync many things" API:

http://oss.sgi.com/archives/xfs/2014-06/msg00214.html

We might be able to make use of that if we're on XFS instead of the big `syncfs` hammer.