Blob Blame History Raw
From 20e22775051d4392b9e41b717711535178395ec4 Mon Sep 17 00:00:00 2001
From: Josef Cejka <>
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 <>


Upstream-commit: a19ff5d8179a7de38109fc78278229fd96f3941a
Signed-off-by: Kamil Dudka <>
 src/df.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/df.c b/src/df.c
index c50aa80..fa20493 100644
--- a/src/df.c
+++ b/src/df.c
@@ -632,6 +632,7 @@ 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))