From 0a438cf302aa19108b7473548c68433b037a9cb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ste=CC=81phane=20Cottin?= Date: Wed, 3 Aug 2016 10:31:29 +0200 Subject: [PATCH] nfs: force remount if needed --- netshare/drivers/nfs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/netshare/drivers/nfs.go b/netshare/drivers/nfs.go index b42b730..6c59d6a 100644 --- a/netshare/drivers/nfs.go +++ b/netshare/drivers/nfs.go @@ -46,7 +46,11 @@ func (n nfsDriver) Mount(r volume.Request) volume.Response { if n.mountm.HasMount(r.Name) && n.mountm.Count(r.Name) > 0 { log.Infof("Using existing NFS volume mount: %s", hostdir) n.mountm.Increment(r.Name) - return volume.Response{Mountpoint: hostdir} + if err := run(fmt.Sprintf("mountpoint -q %s", hostdir)); err != nil { + log.Infof("Existing NFS volume not mounted, force remount.") + } else { + return volume.Response{Mountpoint: hostdir} + } } log.Infof("Mounting NFS volume %s on %s", source, hostdir)