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>
Upstream-commit: e8513675a20e2756e6c2915604605236d1a94d65
Component: engine
This commit is contained in:
Tatsushi Inagaki
2016-02-29 17:42:24 +09:00
parent e1bfcc33fd
commit 9af5c681c5

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