-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
storage: Use private mounts for btrs polling #21519
storage: Use private mounts for btrs polling #21519
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Looking forward to the tests; when I tried to make poll mount points private, I got all kinds of failures. But of course that was just me monkeying around.
pkg/storaged/btrfs/btrfs-tool.py
Outdated
def remove_all_tmp_mountpoints(): | ||
if len(tmp_mountpoints) > 0: | ||
with mount_database() as db: | ||
for mp in set(tmp_mountpoints): | ||
remove_tmp_mountpoint(db, mp) | ||
|
||
for mp in set(tmp_mountpoints): | ||
remove_tmp_mountpoint(mp) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even this could be dropped. There will only be a handful of directories, they cost next to nothing, and now that they are in /run they won't survive a reboot anyway. (Fine to keep it, just thinking aloud)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I was thinking the same, just wanted to produce a version that does a full cleanup first.
Yeah, that TestStorageAnaconda.testBtrfs failure happened for me as well when I tried to make everything private. Then I didn't take time to understand why, but I'm sure you still remember 😅 |
fa42148
to
c613e5c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Even through the stopping/starting during the dialog is a bit awkward, it does make sense - we generally treat dialog values as "snapshot in time", and then catch up.
LGTM aside from the debugging leftovers, but let's see what the tests say.
pkg/storaged/client.js
Outdated
if (btrfs_monitor_channel) | ||
return; | ||
|
||
console.log("STARTING"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debugging leftover (more instances below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I wanted to see them in the logs...
Alright, start/stop of the monitor works. |
c613e5c
to
a3dd43a
Compare
I have removed the cleanup of directories from btrfs-tool as well now. |
a3dd43a
to
2d81e51
Compare
btrfs_monitor_channel.close(); | ||
return res; | ||
} else { | ||
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very good, this means we never try to stop the monitor when it is not actually running.
Note that it is only stopped during dialog actions, after clicking "Do it". The monitor keeps running while the dialog is open. |
Nice, looking good! Now just remove the two obsolete imports, and we should be good to go? 🚀 |
In Anaconda mode, Cockpit mounts a btrfs filesystem to list its subvolumes. Now these mounts are private to the process that does the listing, just like the mounts for making changes already were. Since the mounts are no longer shared, we don't need to maintain a database of their users. The monitor process stops using its own private mounts as soon as it detects a real mount of the filesystem. For this to work, these real mounts need to be visible to the monitor process and thus we need to make its namespace a "slave".
In Anaconda mode. This removes any interference from private mounts during those dialog actions.
2d81e51
to
bea1a45
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers!
btrfs_monitor_channel.close(); | ||
return res; | ||
} else { | ||
return Promise.resolve(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This added line is not executed by any test.
In Anaconda mode, Cockpit mounts a btrfs filesystem to list its subvolumes. Now these mounts are private to the process that does the listing, just like the mounts for making changes already are.
Since the mounts are no longer shared, we don't need to maintain a database of their users.