Skip to content

Commit 19c31a7

Browse files
committed
zfs: correctly apply selinux context
fixes moby#13858 Signed-off-by: Jörg Thalheim <[email protected]>
1 parent b6049b5 commit 19c31a7

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

daemon/graphdriver/zfs/zfs.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"github.com/docker/docker/daemon/graphdriver"
1818
"github.com/docker/docker/pkg/mount"
1919
"github.com/docker/docker/pkg/parsers"
20+
"github.com/docker/libcontainer/label"
2021
zfs "github.com/mistifyio/go-zfs"
2122
)
2223

@@ -268,14 +269,15 @@ func (d *Driver) Remove(id string) error {
268269
func (d *Driver) Get(id, mountLabel string) (string, error) {
269270
mountpoint := d.MountPath(id)
270271
filesystem := d.ZfsPath(id)
271-
log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, mountLabel)
272+
options := label.FormatMountLabel("", mountLabel)
273+
log.Debugf(`[zfs] mount("%s", "%s", "%s")`, filesystem, mountpoint, options)
272274

273275
// Create the target directories if they don't exist
274276
if err := os.MkdirAll(mountpoint, 0755); err != nil && !os.IsExist(err) {
275277
return "", err
276278
}
277279

278-
err := mount.Mount(filesystem, mountpoint, "zfs", mountLabel)
280+
err := mount.Mount(filesystem, mountpoint, "zfs", options)
279281
if err != nil {
280282
return "", fmt.Errorf("error creating zfs mount of %s to %s: %v", filesystem, mountpoint, err)
281283
}

0 commit comments

Comments
 (0)