From a9472f3ee2a833807c1f87c88e480e1f79055395 Mon Sep 17 00:00:00 2001 From: Dacode45 Date: Fri, 1 Jul 2016 14:35:38 -0500 Subject: [PATCH 1/4] Closing the connection after unmounting. Check to see if the error is possibly caused by closing the connection after unmounting. --- fs/fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index 24749a6..8b66f31 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -70,12 +70,12 @@ func (v *VaultFS) Unmount() error { return errors.New("not mounted") } - err := fuse.Unmount(v.mountpoint) + err = v.conn.Close() if err != nil { return err } - err = v.conn.Close() + err := fuse.Unmount(v.mountpoint) if err != nil { return err } From 325e18edb24134a3acf9fd3ad1476ff4e6e3e280 Mon Sep 17 00:00:00 2001 From: Dacode45 Date: Wed, 6 Jul 2016 12:13:16 -0500 Subject: [PATCH 2/4] Added Capabilities method to docker Driver This [commit](https://github.com/docker/go-plugins-helpers/commit/7f7e1f8cba8ccb022b28b400cbefa60452eb4728) extended the Volume Driver interface to require a capabilities method. It tells docker whether data is stored on the local host or in the container. --- docker/driver.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docker/driver.go b/docker/driver.go index 2b05408..90a1f52 100644 --- a/docker/driver.go +++ b/docker/driver.go @@ -75,6 +75,11 @@ func (d Driver) List(r volume.Request) volume.Response { return volume.Response{Volumes: vols} } +// Capabilities tells Docker that data is stored locally +func (d Driver) Capabilities(r volume.Request) volume.Response { + return volume.Response{Capabilities: volume.Capability{Scope: "local"}} +} + // Remove handles volume removal calls func (d Driver) Remove(r volume.Request) volume.Response { d.m.Lock() From 9f1ef76a9c7c1b0db9c1e04794fc4b6140e85c57 Mon Sep 17 00:00:00 2001 From: Dacode45 Date: Wed, 6 Jul 2016 12:26:28 -0500 Subject: [PATCH 3/4] Change that may fix the bad file descriptor error. Occasionally on Centos vaultfs exits with a bad file descriptor error. I figure closing the connection before unmounting would help with this error. --- fs/fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index 8b66f31..6733773 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -70,12 +70,12 @@ func (v *VaultFS) Unmount() error { return errors.New("not mounted") } - err = v.conn.Close() + err := v.conn.Close() if err != nil { return err } - err := fuse.Unmount(v.mountpoint) + err = fuse.Unmount(v.mountpoint) if err != nil { return err } From 67b618b32b6c72ea27fa764368967a11d73579ee Mon Sep 17 00:00:00 2001 From: Dacode45 Date: Wed, 6 Jul 2016 14:48:14 -0500 Subject: [PATCH 4/4] Reverted change where socket was closed before unmounting. This change cause `vault mount` to hang when attempting to kill the process. --- fs/fs.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/fs.go b/fs/fs.go index 6733773..24749a6 100644 --- a/fs/fs.go +++ b/fs/fs.go @@ -70,12 +70,12 @@ func (v *VaultFS) Unmount() error { return errors.New("not mounted") } - err := v.conn.Close() + err := fuse.Unmount(v.mountpoint) if err != nil { return err } - err = fuse.Unmount(v.mountpoint) + err = v.conn.Close() if err != nil { return err }