Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RFC] dir: Clean caches when free space is below threshold #1690

Closed
wants to merge 2 commits into from

Conversation

uajain
Copy link
Contributor

@uajain uajain commented May 18, 2018

If the pull failed due to lack of free space error, it is
not recommended to hold onto partial caches (in repo/tmp) which
can leave the disk-space full. Low-level free disk space error
reporing is not reliable so we alternatively check for free space
using fstatfs(). Hence, we keep partial caches only if free space is
above a certain threshold.

#1119

If the pull failed due to lack of free space error, it is
not recommended to hold onto partial caches (in repo/tmp) which
can leave the disk-space full. Low-level free disk space error
reporing is not reliable so we alternatively check for free space
using fstatfs(). Hence, we keep partial caches only if free space is
above a certain threshold.

flatpak#1119
@rh-atomic-bot
Copy link

Can one of the admins verify this patch?
I understand the following commands:

  • bot, add author to whitelist
  • bot, test pull request
  • bot, test pull request once

@mwleeds
Copy link
Collaborator

mwleeds commented May 19, 2018

bot, test pull request

if (g_error_matches (my_error, G_IO_ERROR, G_FILE_ERROR_NOSPC) ||
flatpak_dir_check_for_free_space (repo))
{
flatpak_dir_cache_clean (repo);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This feels like something that should live in libostree by default; deleting everything in the repo's tmp directory is also going to break anything else concurrently using that directory (although in practice other things would probably also fail with ENOSPC too).

Copy link
Member

Choose a reason for hiding this comment

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

Living in ostree would probably also make it easier to correctly propagate the ENOSPC error.

Copy link
Contributor Author

@uajain uajain May 22, 2018

Choose a reason for hiding this comment

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

I wonder here. The logic here is that, the default action is to clean up (in case of failure), unless the user has free-space above a certain threshold. For e.g. keep caches only if free space is above 5GBs.
The primary reason I chose this is to work around the ENOSPC error (and it's problem in error-reporting).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hi, made a related PR to this in ostree. Please comment on it. ostreedev/ostree#1602

file = g_file_new_for_path (glnx_fdrel_abspath (dfd, "tmp"));

flatpak_rm_rf (file, NULL, NULL);
}
Copy link
Member

Choose a reason for hiding this comment

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

I'm thinking, in the pull case, we should only remove our staging directory, not everything.

In a generic, we're low on disk case we could delete everything, but we should take the repo lock in exclusive mode to avoid running parallel operations mysteriously failing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@alexlarsson Should I take a repo lock and remove the repo/tmp in case of low-disk? That means the latter case you mentioned above.
Also, for the former case, I am not sure how will I get the path of the staging-* in order to remove it.

@rh-atomic-bot
Copy link

☔ The latest upstream changes (presumably ac2d51b) made this pull request unmergeable. Please resolve the merge conflicts.

@uajain
Copy link
Contributor Author

uajain commented Jun 26, 2018

This is now being implemented in Ostree: ostreedev/ostree#1602
Closing this PR.

@uajain uajain closed this Jun 26, 2018
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.

None yet

5 participants