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 707733 - Much more extensive use of at-relative API
Much more extensive use of at-relative API
Status: RESOLVED FIXED
Product: ostree
Classification: Infrastructure
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: OSTree maintainer(s)
OSTree maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2013-09-08 18:05 UTC by Colin Walters
Modified: 2013-09-08 18:52 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
core: Use linkat() for hardlink checkouts too (22.47 KB, patch)
2013-09-08 18:05 UTC, Colin Walters
committed Details | Review
core: Make write_object() a bit more efficient (10.95 KB, patch)
2013-09-08 18:05 UTC, Colin Walters
committed Details | Review
core: Make ostree_set_xattrs() private (3.73 KB, patch)
2013-09-08 18:05 UTC, Colin Walters
committed Details | Review
core: Use at-relative functions for checking out tree copies too (34.55 KB, patch)
2013-09-08 18:05 UTC, Colin Walters
committed Details | Review

Description Colin Walters 2013-09-08 18:05:03 UTC
To repeat, the benefits of this are twofold:

1) It avoids lots of malloc()/g_object_new(G_TYPE_FILE) inside ostree itself
2) The kernel doesn't have to traverse the pathnames over and over.  In particular
   this avoids having to re-do security checks for each access to directories.
Comment 1 Colin Walters 2013-09-08 18:05:05 UTC
Created attachment 254426 [details] [review]
core: Use linkat() for hardlink checkouts too

Clean up how we deal with the uncompressed object cache; we now use
openat()/linkat() and such just like we do for the main objects/.

Use linkat() between the objects and the destination, if possible.
Comment 2 Colin Walters 2013-09-08 18:05:08 UTC
Created attachment 254427 [details] [review]
core: Make write_object() a bit more efficient

Do as many operations as we can using the original file descriptor
while we have it open, rather than writing, closing, then reopening.

This necessitated very explicitly special casing symbolic links,
mainly due to the lack of lsetxattrat().
Comment 3 Colin Walters 2013-09-08 18:05:11 UTC
Created attachment 254428 [details] [review]
core: Make ostree_set_xattrs() private

Nothing external uses it.  We keep ostree_get_xattrs_for_file() public
because it's convenient for external consumers to get xattrs in
exactly the format we desire.
Comment 4 Colin Walters 2013-09-08 18:05:14 UTC
Created attachment 254429 [details] [review]
core: Use at-relative functions for checking out tree copies too

For the cases where we can't hardlink, use at-relative walking of the
path where possible.  We still don't have lsetxattrat, so we also need
to deal with pathnames, but that is now only for symlinks.

Again, the advantages of this are a lot less malloc() of pathnames in
ostree, and much less time spent traversing paths inside the kernel.
Comment 5 Jasper St. Pierre (not reading bugmail) 2013-09-08 18:11:01 UTC
Review of attachment 254426 [details] [review]:

Makes sense.
Comment 6 Jasper St. Pierre (not reading bugmail) 2013-09-08 18:11:29 UTC
Review of attachment 254428 [details] [review]:

OK.
Comment 7 Jasper St. Pierre (not reading bugmail) 2013-09-08 18:20:40 UTC
Review of attachment 254429 [details] [review]:

This one doesn't diff too well.

::: src/libostree/ostree-repo-checkout.c
@@ +50,3 @@
+  /* Don't make setuid files in uncompressed cache */
+  file_mode = g_file_info_get_attribute_uint32 (src_info, "unix::mode");
+  file_mode &= ~(S_ISUID|S_ISGID);

Seems like an unrelated bugfix?

@@ +640,3 @@
+{
+  return checkout_tree_at (self, mode, overwrite_mode,
+                           AT_FDCWD,

This is a clever dirty trick.
Comment 8 Jasper St. Pierre (not reading bugmail) 2013-09-08 18:21:06 UTC
Review of attachment 254427 [details] [review]:

Looks OK.
Comment 9 Colin Walters 2013-09-08 18:52:19 UTC
Attachment 254426 [details] pushed as 9846fb2 - core: Use linkat() for hardlink checkouts too
Attachment 254427 [details] pushed as 27c3e78 - core: Make write_object() a bit more efficient
Attachment 254428 [details] pushed as 0c2ea54 - core: Make ostree_set_xattrs() private
Attachment 254429 [details] pushed as 33e589c - core: Use at-relative functions for checking out tree copies too