]> git.ipfire.org Git - thirdparty/util-linux.git/commit
libmount: try absolute target before canonicalize
authorKarel Zak <kzak@redhat.com>
Thu, 24 Mar 2016 10:51:12 +0000 (11:51 +0100)
committerKarel Zak <kzak@redhat.com>
Wed, 13 Apr 2016 10:29:16 +0000 (12:29 +0200)
commit2238214ddc81d8ecab386d9e38d68f9357e2ad74
tree6787fb2fb67d2b7fdac7c1e75af87828e51a6686
parentb2bff0666101213d5ce9fc4166d8fc5b17581f57
libmount: try absolute target before canonicalize

The path canonicalization is expensive and in many cases unwanted due
to problems with readlink() on unreachable NFS and automounters.

This patch add a possibility to search also by $(CWD)/<path> if the
<path> is relative to reduce number of situation when we convert the
path to the canonical absolute path.

The common use-case:

# cd /some/long/path
# umount ./mountpoint

old version:

15543: libmount:      TAB: [0x560a99a54230]: lookup TARGET: './test'
15543: libmount:    CACHE: [0x560a99a54290]: canonicalize path ./test
15543: libmount:    CACHE: [0x560a99a54290]: add entry [ 1] (path): /mnt/test: ./test
15543: libmount:      TAB: [0x560a99a54230]: lookup canonical TARGET: '/mnt/test'
15543: libmount:      CXT: [0x560a99a54050]: umount fs: /mnt/test

new version:

15597: libmount:      TAB: [0xabf230]: lookup TARGET: './test'
15597: libmount:      TAB: [0xabf230]: lookup absolute TARGET: '/mnt/test'
15597: libmount:      CXT: [0xabf050]: umount fs: /mnt/test

Signed-off-by: Karel Zak <kzak@redhat.com>
include/canonicalize.h
lib/canonicalize.c
libmount/src/tab.c