Skip to content

Conversation

cgwalters
Copy link
Member

@cgwalters cgwalters commented Aug 21, 2025

This is a followup to 6e5a27a
which I believe is correct as is. However, we already have a file
descriptor open for the ostree repo, which must be on
the same filesystem as /sysroot/ostree (the deployment
code forces hardlinking today).

It's hence cleaner to reuse that extant fd instead of opening
a new one - we know we did writes to that fd.

But going farther here, there already is logic to use syncfs
for the repo when downloading objects (in a common case
we actually syncfs twice).

Since these are really the same operation, unify them:

  • Add journaling to the repo one syncfs case
  • Change the sysroot case to just call it
  • Since we log consistently to the journal for all syncfs/fsfreeze
    operations now, drop the SyncStats bits which was a way
    to add info about that to a later journal message

Additionally, let's add an extra check when we're
opening the repo that it's on the same device just on general
principle.

Signed-off-by: Colin Walters walters@verbum.org


Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors full_system_sync() to use an existing repository file descriptor, which is a good simplification. It also adds a new validation in ensure_repo() to confirm that the sysroot and repository are on the same device, enhancing robustness. My review includes a minor suggestion to improve the portability of an error message's format string.

@champtar champtar changed the title sysroot: Sync repo fd, require sysroot dev == repo dev sysroot: Sync repo fd, require ostree/ dev == ostree/repo dev Aug 25, 2025
@cgwalters cgwalters marked this pull request as draft August 25, 2025 14:36
This is a followup to ostreedev@6e5a27a
which I believe is correct as is. However, we already have a file
descriptor open for the ostree repo, which *must* be on
the same filesystem as `/sysroot/ostree` (the deployment
code forces hardlinking today).

It's hence cleaner to reuse that extant fd instead of opening
a new one - we know we did writes to that fd.

But going farther here, there already is logic to use syncfs
for the repo when downloading objects (in a common case
we actually syncfs twice).

Since these are really the same operation, unify them:

- Add journaling to the repo one syncfs case
- Change the sysroot case to just call it
- Since we log consistently to the journal for all syncfs/fsfreeze
  operations now, drop the SyncStats bits which was a way
  to add info about that to a later journal message

Additionally, let's add an extra check when we're
opening the repo that it's on the same device just on general
principle.

Signed-off-by: Colin Walters <walters@verbum.org>
@cgwalters cgwalters changed the title sysroot: Sync repo fd, require ostree/ dev == ostree/repo dev Deduplicate repo+sysroot syncfs logic Aug 25, 2025
@cgwalters
Copy link
Member Author

OK I rewrote this one again, it's now one commit and syncs up the syncfs logic

@cgwalters cgwalters marked this pull request as ready for review August 25, 2025 15:59
@cgwalters cgwalters requested a review from champtar August 25, 2025 15:59
@cgwalters cgwalters enabled auto-merge August 25, 2025 20:47

if (self->disable_fsync)
return TRUE;
/* FIXME: Added OSTREE_SUPPRESS_SYNCFS since valgrind in el7 doesn't know
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

EL 7 is long dead, should we drop OSTREE_SUPPRESS_SYNCFS ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I just kept it on the principle of not changing too many things at once.

@cgwalters cgwalters merged commit edfe02d into ostreedev:main Aug 25, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants