The following pull request was submitted through Github.
It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/3417

This e-mail was sent by the LXC bot, direct replies will not reach the author
unless they happen to be subscribed to this list.

=== Description (from pull-request) ===
Closes #3412.

Signed-off-by: Christian Brauner <[email protected]>
From f9f47df4e71b8c369b69933ca70654480dbe10c1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <[email protected]>
Date: Thu, 15 Jun 2017 19:38:40 +0200
Subject: [PATCH] container_lxc: fail on ebusy on start hook

Closes #3412.

Signed-off-by: Christian Brauner <[email protected]>
---
 lxd/container_lxc.go | 19 ++++++++++++++++++-
 lxd/storage_zfs.go   |  2 +-
 2 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index b6b54b49c..07f34ac98 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -2029,7 +2029,7 @@ func (c *containerLXC) OnStart() error {
        c.fromHook = true
 
        // Start the storage for this container
-       ourStart, err := c.StorageStart()
+       ourStart, err := c.StorageStartSensitive()
        if err != nil {
                return err
        }
@@ -5180,6 +5180,23 @@ func (c *containerLXC) StorageStart() (bool, error) {
                return false, err
        }
 
+       isOurOperation, err := c.StorageStartSensitive()
+       // Remove this as soon as zfs is fixed
+       if c.storage.GetStorageType() == storageTypeZfs && err == syscall.EBUSY 
{
+               return isOurOperation, nil
+       }
+
+       return isOurOperation, err
+}
+
+// Kill this function as soon as zfs is fixed.
+func (c *containerLXC) StorageStartSensitive() (bool, error) {
+       // Initialize storage interface for the container.
+       err := c.initStorage()
+       if err != nil {
+               return false, err
+       }
+
        isOurOperation := false
        if c.IsSnapshot() {
                isOurOperation, err = c.storage.ContainerSnapshotStart(c)
diff --git a/lxd/storage_zfs.go b/lxd/storage_zfs.go
index 76c3364a7..822a7d070 100644
--- a/lxd/storage_zfs.go
+++ b/lxd/storage_zfs.go
@@ -462,7 +462,7 @@ func (s *storageZfs) ContainerMount(c container) (bool, 
error) {
                        // tracking. So ignore them for now, report back that
                        // the mount isn't ours and proceed.
                        logger.Warnf("ZFS returned EBUSY while \"%s\" is 
actually not a mountpoint.", containerPoolVolumeMntPoint)
-                       return false, nil
+                       return false, mounterr
                }
                ourMount = true
        }
_______________________________________________
lxc-devel mailing list
[email protected]
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to