Repository navigation
Avoid extra mount/unmount during container registration - #4067
Conversation
Runtime.Register() called driver.Get()/Put() in order to read back the basefs of the container. However, this is not needed, as the basefs is read during container.Mount() anyway, and basefs is only valid while mounted (and all current calls satisfy this). This seems minor, but this is actually problematic, as the Get/Put pair will create a spurious mount/unmount cycle that is not needed and slows things down. Additionally it will create a supurious devicemapper activate/deactivate cycle that causes races with udev as seen in moby#4036. With this change devicemapper is now race-free, and container startup is slightly faster. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <[email protected]> (github: alexlarsson)
|
LGTM ping @creack @crosbymichael @vieux |
|
I thought the point of reference counting and the driver Get method is that we can call it as many times as we want and there are no side effects if it is already mounted. Shouldn't the fix happen in the device mapper driver ? |
|
@crosbymichael You can, but at this point there are no other gets, so a get() will mount, and a put() will then unmount. Then a bit later there will be a new get() that mounts it for real use in the started container. |
|
LGTM |
Avoid extra mount/unmount during container registration
|
I encountered this problem in Docker 1.9 as well ! |
|
+1 still an issue |
2 similar comments
|
+1 still an issue |
|
+1 still an issue |
|
+1 |
|
To those adding +1's, please open a new issue describing the exact issue, and ways to reproduce. Commenting on a closed pull request that's over two years old, and containing code changes in parts of docker that are not even in the current code base anymore, isn't helpful, and likely won't help resolving your issue. I'll lock this conversation |
Runtime.Register() called driver.Get()/Put() in order to read back the
basefs of the container. However, this is not needed, as the basefs
is read during container.Mount() anyway, and basefs is only valid
while mounted (and all current calls satisfy this).
This seems minor, but this is actually problematic, as the Get/Put
pair will create a spurious mount/unmount cycle that is not needed and
slows things down. Additionally it will create a supurious
devicemapper activate/deactivate cycle that causes races with udev as
seen in #4036.
With this change devicemapper is now race-free, and container startup
is slightly faster.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson [email protected] (github: alexlarsson)