File coreutils-no_stat_for_dummy_fs.patch of Package coreutils.4414
>From 12c1918e836711d1a25dcb936dbc65c1e31d0813 Mon Sep 17 00:00:00 2001
From: Josef Cejka <address@hidden>
Date: Tue, 1 Aug 2017 01:50:34 +0200
Subject: [PATCH] df: avoid stat() for dummy file systems with -l
When systemd is configured to automount a remote file system - see
'man systemd.automount(5)', then the mount point is initially
mounted by systemd with the file system type "autofs".
When the resource is used later on, then the wanted file system is
mounted over that mount point on demand.
'df -l' triggered systemd to mount the file system because it called
stat() on the mount point.
Instead of single-casing "autofs" targets, we can avoid stat()ing
all dummy file systems (which includes "autofs"), because those are
skipped later on in get_dev() anyway.
*src/df.c (filter_mount_list): Also skip dummy file systems unless
the -a option or a specific target are given.
* NEWS: Mention the fix.
Co-authored-by: Bernhard Voelker <address@hidden>
src/df.c | 2 ++
1 file changed, 2 insertions(+)
--- src/df.c.orig 2017-10-23 10:11:17.900207967 +0200
+++ src/df.c 2017-10-23 10:12:30.672324757 +0200
@@ -673,6 +673,8 @@ filter_mount_list (bool devices_only)
On Linux we probably have me_dev populated from /proc/self/mountinfo,
however we still stat() in case another device was mounted later. */
if ((me->me_remote && show_local_fs)
+ || (me->me_dummy && !show_all_fs && !show_listed_fs)
+ || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type))
|| -1 == stat (me->me_mountdir, &buf))
/* If remote, and showing just local, add ME for filtering later.