浏览代码

zfs: correctly apply selinux context

fixes #13858

Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>
Jörg Thalheim 10 年之前
父节点
当前提交
19c31a703f
共有 1 个文件被更改,包括 4 次插入2 次删除
  1. 4 2
      daemon/graphdriver/zfs/zfs.go

+ 4 - 2
daemon/graphdriver/zfs/zfs.go

@@ -17,6 +17,7 @@ import (
 	"github.com/docker/docker/daemon/graphdriver"
 	"github.com/docker/docker/pkg/mount"
 	"github.com/docker/docker/pkg/parsers"
+	"github.com/docker/libcontainer/label"
 	zfs "github.com/mistifyio/go-zfs"
 )
 
@@ -268,14 +269,15 @@ func (d *Driver) Remove(id string) error {
 func (d *Driver) Get(id, mountLabel string) (string, error) {
 	mountpoint := d.MountPath(id)
 	filesystem := d.ZfsPath(id)
-	log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, mountLabel)
+	options := label.FormatMountLabel("", mountLabel)
+	log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, options)
 
 	// Create the target directories if they don't exist
 	if err := os.MkdirAll(mountpoint, 0755); err != nil && !os.IsExist(err) {
 		return "", err
 	}
 
-	err := mount.Mount(filesystem, mountpoint, "zfs", mountLabel)
+	err := mount.Mount(filesystem, mountpoint, "zfs", options)
 	if err != nil {
 		return "", fmt.Errorf("error creating zfs mount of %s to %s: %v", filesystem, mountpoint, err)
 	}