Browse code

vfs gd: ignore quota setup errors

This is a fix to regression in vfs graph driver introduced by
commit 7a1618ced359a3ac92 ("add quota support to VFS graphdriver").

On some filesystems, vfs fails to init with the following error:

> Error starting daemon: error initializing graphdriver: Failed to mknod
> /go/src/github.com/docker/docker/bundles/test-integration/d6bcf6de610e9/root/vfs/backingFsBlockDev:
> function not implemented

As quota is not essential for vfs, let's ignore (but log as a warning) any error
from quota init.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>

Kir Kolyshkin authored on 2017/12/20 06:47:12
Showing 2 changed files
... ...
@@ -35,9 +35,7 @@ func Init(home string, options []string, uidMaps, gidMaps []idtools.IDMap) (grap
35 35
 		return nil, err
36 36
 	}
37 37
 
38
-	if err := setupDriverQuota(d); err != nil {
39
-		return nil, err
40
-	}
38
+	setupDriverQuota(d)
41 39
 
42 40
 	return graphdriver.NewNaiveDiffDriver(d, uidMaps, gidMaps), nil
43 41
 }
... ...
@@ -2,20 +2,21 @@
2 2
 
3 3
 package vfs
4 4
 
5
-import "github.com/docker/docker/daemon/graphdriver/quota"
5
+import (
6
+	"github.com/docker/docker/daemon/graphdriver/quota"
7
+	"github.com/sirupsen/logrus"
8
+)
6 9
 
7 10
 type driverQuota struct {
8 11
 	quotaCtl *quota.Control
9 12
 }
10 13
 
11
-func setupDriverQuota(driver *Driver) error {
14
+func setupDriverQuota(driver *Driver) {
12 15
 	if quotaCtl, err := quota.NewControl(driver.home); err == nil {
13 16
 		driver.quotaCtl = quotaCtl
14 17
 	} else if err != quota.ErrQuotaNotSupported {
15
-		return err
18
+		logrus.Warnf("Unable to setup quota: %v\n", err)
16 19
 	}
17
-
18
-	return nil
19 20
 }
20 21
 
21 22
 func (d *Driver) setupQuota(dir string, size uint64) error {