-
Notifications
You must be signed in to change notification settings - Fork 18.7k
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
devmapper: Increase sleep times and unlock while sleeping #4504
Conversation
We currently use a global lock to protect global data (like the Devices map) as well as device data itself and access to (non-threadsafe) libdevmapper. This commit also adds a per-device lock, which will allow per-device operations to temporarily release the global lock while e.g. waiting. The per-device lock will make sure that nothing else accesses that device while we're operating on it. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
We've seen some cases in the wild where waiting for unmount/deactivate of devmapper devices taking a long time (several seconds). So, we increase the sleeps to 10 seconds before we timeout. For instance: moby#4389 But, in order to not keep other processes blocked we unlock the global dm lock while waiting to allow other devices to continue working. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
LGTM |
time.Sleep(5 * time.Millisecond) | ||
devices.Unlock() | ||
time.Sleep(10 * time.Millisecond) | ||
devices.Lock() |
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.
Should we unlock here before returning?
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.
No, the lock is held when we enter. Its taken at all the public entry points. We should leave it held when we return.
LGTM |
devmapper: Increase sleep times and unlock while sleeping
As reported in moby/moby#4389 we're currently seeing timeouts in waitClose on some systems. We already bumped the timeout in waitRemove() in moby/moby#4504. Docker-DCO-1.1-Signed-off-by: Alexander Larsson <alexl@redhat.com> (github: alexlarsson)
We've seen some cases in the wild where waiting for unmount/deactivate
of devmapper devices taking a long time (several seconds). So, we increase
the sleeps to 10 seconds before we timeout. For instance:
#4389
But, in order to not keep other processes blocked we unlock the global
dm lock while waiting to allow other devices to continue working.
Docker-DCO-1.1-Signed-off-by: Alexander Larsson alexl@redhat.com (github: alexlarsson)