From c7b963bfa76b9541e01493d21fef3e3596ef9904 Mon Sep 17 00:00:00 2001 From: Eric Biggers Date: Tue, 29 Oct 2019 00:04:39 -0700 Subject: [PATCH] filesystem: skip unnecessary mountpoint canonicalization The kernel always shows mountpoints as absolute paths without symlinks, so there's no need to canonicalize them in userspace. --- filesystem/mountpoint.go | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/filesystem/mountpoint.go b/filesystem/mountpoint.go index c43e14e..861f5b1 100644 --- a/filesystem/mountpoint.go +++ b/filesystem/mountpoint.go @@ -134,12 +134,6 @@ func loadMountInfo() error { continue } - // Skip invalid mountpoints - var err error - if mnt.Path, err = canonicalizePath(mnt.Path); err != nil { - log.Printf("getting mnt_dir: %v", err) - continue - } // We can only use mountpoints that are directories for fscrypt. if !isDir(mnt.Path) { log.Printf("ignoring mountpoint %q because it is not a directory", mnt.Path) @@ -151,6 +145,7 @@ func loadMountInfo() error { // filesystems are listed in mount order. mountsByPath[mnt.Path] = mnt + var err error mnt.Device, err = canonicalizePath(mnt.Device) // Only use real valid devices (unlike cgroups, tmpfs, ...) if err == nil && isDevice(mnt.Device) { -- 2.39.5