mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Image.Changes: Deactivate image device after unmounting it
There is no need to keep the image device around if we were the onces creating the device.
This commit is contained in:
parent
395bce4c41
commit
6c7ae06435
1 changed files with 5 additions and 0 deletions
5
image.go
5
image.go
|
@ -617,6 +617,8 @@ func (image *Image) Changes(runtime *Runtime, root, rw, id string) ([]Change, er
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wasActivated := devices.HasActivatedDevice(image.ID)
|
||||||
|
|
||||||
// We re-use rw for the temporary mount of the base image as its
|
// We re-use rw for the temporary mount of the base image as its
|
||||||
// not used by device-mapper otherwise
|
// not used by device-mapper otherwise
|
||||||
err = devices.MountDevice(image.ID, rw)
|
err = devices.MountDevice(image.ID, rw)
|
||||||
|
@ -626,6 +628,9 @@ func (image *Image) Changes(runtime *Runtime, root, rw, id string) ([]Change, er
|
||||||
|
|
||||||
changes, err := ChangesDirs(root, rw)
|
changes, err := ChangesDirs(root, rw)
|
||||||
_ = devices.UnmountDevice(image.ID, rw)
|
_ = devices.UnmountDevice(image.ID, rw)
|
||||||
|
if !wasActivated {
|
||||||
|
_ = devices.DeactivateDevice(image.ID)
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue