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>
This commit is contained in:
Tatsushi Inagaki 2016-02-29 17:42:24 +09:00
parent cb6cdb416c
commit e8513675a2

View file

@ -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