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

Shutdown nydusd if it serves no filesystem or snapshot #260

Merged
merged 8 commits into from
Nov 25, 2022

Conversation

changweige
Copy link
Member

In sharedDaemon mode, we should also shut down the shared nydusd if it is not needed by any snapshot.

In addition, we should retain the shared daemon object in fs layer when doing recovery during nydus-snapshotter startup.

@codecov-commenter
Copy link

codecov-commenter commented Nov 24, 2022

Codecov Report

Base: 35.93% // Head: 35.95% // Increases project coverage by +0.02% 🎉

Coverage data is based on head (18f3822) compared to base (b2962d5).
Patch coverage: 0.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #260      +/-   ##
==========================================
+ Coverage   35.93%   35.95%   +0.02%     
==========================================
  Files          28       28              
  Lines        2858     2859       +1     
==========================================
+ Hits         1027     1028       +1     
- Misses       1724     1725       +1     
+ Partials      107      106       -1     
Impacted Files Coverage Δ
pkg/daemon/daemon.go 0.00% <0.00%> (ø)
pkg/manager/manager.go 22.04% <0.00%> (+0.65%) ⬆️
pkg/store/database.go 38.50% <0.00%> (-0.63%) ⬇️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.


// Found shared daemon
// Fscache userspace daemon has no host mountpoint.
if d.HostMountpoint() == fs.rootMountpoint || fs.fsDriver == config.FsDriverFscache {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Maybe put it in a helper func.

Copy link
Member Author

Choose a reason for hiding this comment

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

extracted a help function tryRetainSharedDaemon


for _, d := range liveDaemons {
// Found shared daemon
if d.HostMountpoint() == fs.rootMountpoint || fs.fsDriver == config.FsDriverFscache {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ditto.

Copy link
Collaborator

@imeoer imeoer left a comment

Choose a reason for hiding this comment

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

Others LGTM!

So the modules can rely on this to decide if stop nydusd
daemon.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
As the snapshot and rafs intance is well managed now,
we can easily umount a snapshot by its ID.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
We can reliably judege the recoverd daemon is shared one
when its host mount point equals to the root mount point.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
Stop the shared daemon when closing snapshotter if
no snapshots is referenced to the shared daemon.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
Beyond nydusd 2.1, data blob cache has a suffix .blob.data

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
So we can know more about nydusd and snapshots via
management API.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
Make the log lines more suggestive and clear.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
No need to use has_daemon to check.

Signed-off-by: Changwei Ge <gechangwei@bytedance.com>
@changweige changweige force-pushed the exit-daemon-after-ref0 branch from 18f3822 to cbe79da Compare November 25, 2022 09:42
@changweige changweige merged commit a6fc3af into containerd:main Nov 25, 2022
@changweige changweige deleted the exit-daemon-after-ref0 branch November 28, 2022 05:44
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.

3 participants