From 205bc6fc99872ba852fa7a158c106514d5b64179 Mon Sep 17 00:00:00 2001 From: Damian Smyth Date: Mon, 18 Jul 2016 14:11:00 +1000 Subject: [PATCH] Create zfs directory if it doesn't exist at startup. Signed-off-by: Damian Smyth --- daemon/graphdriver/zfs/zfs.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/daemon/graphdriver/zfs/zfs.go b/daemon/graphdriver/zfs/zfs.go index f6a531c82e..2a50623a60 100644 --- a/daemon/graphdriver/zfs/zfs.go +++ b/daemon/graphdriver/zfs/zfs.go @@ -99,6 +99,14 @@ func Init(base string, opt []string, uidMaps, gidMaps []idtools.IDMap) (graphdri return nil, fmt.Errorf("BUG: zfs get all -t filesystem -rHp '%s' should contain '%s'", options.fsName, options.fsName) } + rootUID, rootGID, err := idtools.GetRootUIDGID(uidMaps, gidMaps) + if err != nil { + return nil, fmt.Errorf("Failed to get root uid/guid: %v", err) + } + if err := idtools.MkdirAllAs(base, 0700, rootUID, rootGID); err != nil { + return nil, fmt.Errorf("Failed to create '%s': %v", base, err) + } + if err := mount.MakePrivate(base); err != nil { return nil, err }