浏览代码

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 <e29253@jp.ibm.com>
Tatsushi Inagaki 9 年之前
父节点
当前提交
e8513675a2
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      daemon/graphdriver/aufs/aufs.go

+ 5 - 1
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