[lxc-devel] [lxd/master] container_lxc: fail on ebusy on start hook
brauner on Github
lxc-bot at linuxcontainers.org
Thu Jun 15 17:40:45 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 381 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170615/9658d237/attachment.bin>
-------------- next part --------------
From f9f47df4e71b8c369b69933ca70654480dbe10c1 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
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 <christian.brauner at ubuntu.com>
---
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
}
More information about the lxc-devel
mailing list