File tree Expand file tree Collapse file tree 2 files changed +4
-2
lines changed
Expand file tree Collapse file tree 2 files changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -141,7 +141,7 @@ func (m *mountManager) Increment(name string) int {
141141
142142func (m * mountManager ) Decrement (name string ) int {
143143 c , found := m .mounts [name ]
144- if found {
144+ if found && c . connections > 0 {
145145 c .connections --
146146 }
147147 return 0
Original file line number Diff line number Diff line change @@ -60,6 +60,7 @@ func (n nfsDriver) Mount(r volume.MountRequest) volume.Response {
6060 if err := run (fmt .Sprintf ("grep -c %s /proc/mounts" , hostdir )); err != nil {
6161 log .Infof ("Existing NFS volume not mounted, force remount." )
6262 } else {
63+ n .mountm .Increment (resolvedName )
6364 return volume.Response {Mountpoint : hostdir }
6465 }
6566 }
@@ -74,10 +75,11 @@ func (n nfsDriver) Mount(r volume.MountRequest) volume.Response {
7475 n .mountm .Create (resolvedName , hostdir , resOpts )
7576 }
7677
78+ n .mountm .Add (resolvedName , hostdir )
79+
7780 if err := n .mountVolume (resolvedName , source , hostdir , n .version ); err != nil {
7881 return volume.Response {Err : err .Error ()}
7982 }
80- n .mountm .Add (resolvedName , hostdir )
8183
8284 if n .mountm .GetOption (resolvedName , ShareOpt ) != "" && n .mountm .GetOptionAsBool (resolvedName , CreateOpt ) {
8385 log .Infof ("Mount: Share and Create options enabled - using %s as sub-dir mount" , resolvedName )
You can’t perform that action at this time.
0 commit comments