daemon/c8d: Unmount container fs after unclean shutdown#46770
daemon/c8d: Unmount container fs after unclean shutdown#46770vvoland merged 1 commit intomoby:masterfrom
Conversation
|
Alternative solution could be to restore the Lines 281 to 288 in ed1a61d We kinda already have it, but it's peformed later - there's a funny part later which does Mount+Unmount to populate the BaseFS: Lines 459 to 471 in ed1a61d that's too late for the "cleanup alive containers" at startup, because the cleanup is caused by the event sent when the containerd task is killed and it gets called before the Mount+Unmount code has the chance to run. |
d40467a to
cbfb535
Compare
| // Check if the refcount is non-zero. | ||
| m.rc.Increment(target) | ||
| if m.rc.Decrement(target) > 0 { |
There was a problem hiding this comment.
Not sure if I understand this part; we're incrementing , and immediately after that decrementing.
Is this because we don't have a different way to get the active counter?
There was a problem hiding this comment.
Yeah, graphdriver.RefCount only has Increment and Decrement
There was a problem hiding this comment.
I created a ticket for this; if we want to track that in code, we could add TODO comment here so that we don't forget.
There was a problem hiding this comment.
Also opened a tracking issue for handling reference-counting, as I was looking at this code, and stumbled on the hard-coded `` list again 😂
cbfb535 to
b2aa90c
Compare
thaJeztah
left a comment
There was a problem hiding this comment.
LGTM, but perhaps could use more eyes
BaseFS is not serialized and is lost after an unclean shutdown. Unmount method in the containerd image service implementation will not work correctly in that case. This patch will allow Unmount to restore the BaseFS if the target is still mounted. The reason it works with graphdrivers is that it doesn't directly operate on BaseFS. It uses RWLayer, which is explicitly restored immediately as soon as container is loaded. Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
b2aa90c to
203bac0
Compare
|
Thanks for the review! |
BaseFSis not serialized and is lost after an unclean shutdown.Unmountmethod in the containerd image service implementation will not work correctly in that case.This patch will allow
Unmountto restore theBaseFSif the target is still mounted.The reason it works with graphdrivers is that it doesn't directly operate on
BaseFS. It usesRWLayer, which is explicitly restored immediately as soon as container is loaded.- What I did
- How I did it
- How to verify it
- Description for the changelog
- A picture of a cute animal (not mandatory but encouraged)