Browse code

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 authored on 2016/02/29 17:42:24
Showing 1 changed files
... ...
@@ -468,7 +468,11 @@ func (a *Driver) unmount(m *data) error {
468 468
 }
469 469
 
470 470
 func (a *Driver) mounted(m *data) (bool, error) {
471
-	return mountpk.Mounted(m.path)
471
+	var buf syscall.Statfs_t
472
+	if err := syscall.Statfs(m.path, &buf); err != nil {
473
+		return false, nil
474
+	}
475
+	return graphdriver.FsMagic(buf.Type) == graphdriver.FsMagicAufs, nil
472 476
 }
473 477
 
474 478
 // Cleanup aufs and unmount all mountpoints