[lxc-devel] [lxd/master] btrfs: Apply default flags BEFORE detecting type
stgraber on Github
lxc-bot at linuxcontainers.org
Tue Jun 13 20:03:27 UTC 2017
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 370 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20170613/4e9b1c77/attachment.bin>
-------------- next part --------------
From 865ec4ee242c6b6e1c44f440f686d1880e48afc1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?St=C3=A9phane=20Graber?= <stgraber at ubuntu.com>
Date: Tue, 13 Jun 2017 16:02:18 -0400
Subject: [PATCH] btrfs: Apply default flags BEFORE detecting type
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Closes #3409
Signed-off-by: Stéphane Graber <stgraber at ubuntu.com>
---
lxd/storage_btrfs.go | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/lxd/storage_btrfs.go b/lxd/storage_btrfs.go
index a403b5e8e..dbe8105ba 100644
--- a/lxd/storage_btrfs.go
+++ b/lxd/storage_btrfs.go
@@ -354,7 +354,6 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
}
lxdStorageMapLock.Unlock()
}
-
defer removeLockFromMap()
// Check whether the mount poolMntPoint exits.
@@ -369,7 +368,7 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
return false, nil
}
- mountFlags := uintptr(0)
+ mountFlags, mountOptions := lxdResolveMountoptions(s.getBtrfsMountOptions())
mountSource := source
isBlockDev := shared.IsBlockdevPath(source)
if filepath.IsAbs(source) {
@@ -391,7 +390,7 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
defer loopF.Close()
} else if !isBlockDev && cleanSource != poolMntPoint {
mountSource = source
- mountFlags = syscall.MS_BIND
+ mountFlags |= syscall.MS_BIND
} else if !isBlockDev && cleanSource == poolMntPoint && s.d.BackingFs == "btrfs" {
return false, nil
}
@@ -412,14 +411,12 @@ func (s *storageBtrfs) StoragePoolMount() (bool, error) {
// detection task.
return false, nil
}
-
}
- mountFlags, mountOptions := lxdResolveMountoptions(s.getBtrfsMountOptions())
mountFlags |= s.remount
err := syscall.Mount(mountSource, poolMntPoint, "btrfs", mountFlags, mountOptions)
if err != nil {
- logger.Errorf("failed to mount BTRFS storage pool \"%s\" onto \"%s\" with mountoptions \"%s\": %s", mountSource, poolMntPoint, mountOptions, err)
+ logger.Errorf("Failed to mount BTRFS storage pool \"%s\" onto \"%s\" with mountoptions \"%s\": %s", mountSource, poolMntPoint, mountOptions, err)
return false, err
}
More information about the lxc-devel
mailing list