From e8513675a20e2756e6c2915604605236d1a94d65 Mon Sep 17 00:00:00 2001 From: Tatsushi Inagaki Date: Mon, 29 Feb 2016 17:42:24 +0900 Subject: [PATCH] Aufs: reduce redundant parsing of mountinfo Check whether or not the file system type of a mountpoint is aufs by calling statfs() instead of parsing mountinfo. This assumes that aufs graph driver does not allow aufs as a backing file system. Signed-off-by: Tatsushi Inagaki --- daemon/graphdriver/aufs/aufs.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/daemon/graphdriver/aufs/aufs.go b/daemon/graphdriver/aufs/aufs.go index a5b80f0534..ac0bc5f483 100644 --- a/daemon/graphdriver/aufs/aufs.go +++ b/daemon/graphdriver/aufs/aufs.go @@ -468,7 +468,11 @@ func (a *Driver) unmount(m *data) error { } func (a *Driver) mounted(m *data) (bool, error) { - return mountpk.Mounted(m.path) + var buf syscall.Statfs_t + if err := syscall.Statfs(m.path, &buf); err != nil { + return false, nil + } + return graphdriver.FsMagic(buf.Type) == graphdriver.FsMagicAufs, nil } // Cleanup aufs and unmount all mountpoints