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

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 #6853

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
From 6428f8287f433bec7da838cb48e65457dba29c99 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgra...@ubuntu.com>
Date: Mon, 10 Feb 2020 16:43:32 -0500
Subject: [PATCH] lxd/container: Protect file push/pull from shift
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Closes #6853

Signed-off-by: Stéphane Graber <stgra...@ubuntu.com>
---
 lxd/container_lxc.go | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/lxd/container_lxc.go b/lxd/container_lxc.go
index 5f2f972754..361ff52d6e 100644
--- a/lxd/container_lxc.go
+++ b/lxd/container_lxc.go
@@ -5349,6 +5349,12 @@ func (c *containerLXC) FileExists(path string) error {
 }
 
 func (c *containerLXC) FilePull(srcpath string, dstpath string) (int64, int64, 
os.FileMode, string, []string, error) {
+       // Check for ongoing operations (that may involve shifting).
+       op := operationlock.Get(c.id)
+       if op != nil {
+               op.Wait()
+       }
+
        var ourStart bool
        var err error
        // Setup container storage if needed
@@ -5472,6 +5478,12 @@ func (c *containerLXC) FilePull(srcpath string, dstpath 
string) (int64, int64, o
 }
 
 func (c *containerLXC) FilePush(type_ string, srcpath string, dstpath string, 
uid int64, gid int64, mode int, write string) error {
+       // Check for ongoing operations (that may involve shifting).
+       op := operationlock.Get(c.id)
+       if op != nil {
+               op.Wait()
+       }
+
        var rootUid int64
        var rootGid int64
        var errStr string
_______________________________________________
lxc-devel mailing list
lxc-devel@lists.linuxcontainers.org
http://lists.linuxcontainers.org/listinfo/lxc-devel

Reply via email to