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

Avoid using unnecessary udev.settle calls #897

Conversation

vojtechtrefny
Copy link
Member

Apparently it is completely normal to have hundreds of btrfs snapshots and blivet is currently not very good in handling this situation. reset is relatively fast, but teardown_all (which anaconda runs multiple times during installation) can take more than 10 minutes on systems with 500 snapshots (rhbz#1876162).

I was able to find two issues in our code:

  • MountsCache uses udev.resolve_device for every mountpoint query. resolve_device itself uses udev.settle and also iterates over all devices in the UDev database.
  • StorageDevice._pre_teardown always runs udev.settle even when the teardown is no-op. This means we run udev.settle 3 times for every snapshot during teardown_all.

Copy link
Contributor

@vpodzime vpodzime left a comment

Choose a reason for hiding this comment

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

Try to not used in the first commit message. Looks good to me otherwise.

udev.resolve_devspec is slow and uses udev.settle, we should avoid
using it if possible when getting system mountpoints.
We currently run udev.settle for every _pre_teardown call even if
there is no change or format teardown. This commit moves the
udev.settle call to format classes so it is called only when
format.teardown calls in _pre_teardown change the format.
Copy link
Contributor

@dwlehman dwlehman left a comment

Choose a reason for hiding this comment

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

You could also set a flag based on the initial status of the format and then conditionally call settle only when the flag indicates that the format was initially active. It would change less, but I'm not sure if it's actually better. It's probably a good thing to explicitly call settle every time we tear down a format, whether that's done in DeviceFormat.teardown or in the subclasses as you've done.

@vojtechtrefny vojtechtrefny merged commit c7c358f into storaged-project:3.3-devel Sep 16, 2020
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

4 participants