mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Fix panic on devicemapper initialization
The ability to save and verify base device UUID (#13896) introduced a situation where the initialization would panic when removing the device returns EBUSY. Functions `verifyBaseDeviceUUID` and `saveBaseDeviceUUID` now take the lock on the `DeviceSet`, which solves the problem as `removeDevice` assumes it owns the lock. Signed-off-by: Arnaud Porterie <arnaud.porterie@docker.com>
This commit is contained in:
parent
2fe51ecee7
commit
f089899023
1 changed files with 6 additions and 0 deletions
|
@ -691,6 +691,9 @@ func getDeviceUUID(device string) (string, error) {
|
|||
}
|
||||
|
||||
func (devices *DeviceSet) verifyBaseDeviceUUID(baseInfo *DevInfo) error {
|
||||
devices.Lock()
|
||||
defer devices.Unlock()
|
||||
|
||||
if err := devices.activateDeviceIfNeeded(baseInfo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -710,6 +713,9 @@ func (devices *DeviceSet) verifyBaseDeviceUUID(baseInfo *DevInfo) error {
|
|||
}
|
||||
|
||||
func (devices *DeviceSet) saveBaseDeviceUUID(baseInfo *DevInfo) error {
|
||||
devices.Lock()
|
||||
defer devices.Unlock()
|
||||
|
||||
if err := devices.activateDeviceIfNeeded(baseInfo); err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue