Azure / azurefile-dockervolumedriver

Docker Volume Driver for Azure File Service over SMB/CIFS :whale:
Apache License 2.0
169 stars 55 forks source link

Handle mountpoint removal in duplicate mounts #25

Closed ahmetb closed 8 years ago

ahmetb commented 8 years ago

Docker does not keep track of what is mounted and what is not, it will issue /Volume.Mount and /Volume.Unmount requests regardless when multiple containers use the same volume simulatenosly. This leads to duplicate mount entries and requirement for a careful cleanup of the mountpath in this patch.

If same path is mounted multiple times, duplicate entries will occur in mount table for the same mountpoint. These are mostly fine and harmless. However umount will remove the mount entry and attempting to remove the mountpoint at this time is not okay as it still has active mount(s).

In that case, we read the mount table to see if there is still something mounted, and only when there is nothing mounted, we remove the mountpoint.

Fixes #23.

cc: @sascha-egerer