740027
From 20e22775051d4392b9e41b717711535178395ec4 Mon Sep 17 00:00:00 2001
740027
From: Josef Cejka <jcejka@suse.com>
740027
Date: Tue, 1 Aug 2017 01:50:34 +0200
740027
Subject: [PATCH] df: avoid stat() for dummy file systems with -l
740027
740027
When systemd is configured to automount a remote file system - see
740027
'man systemd.automount(5)', then the mount point is initially
740027
mounted by systemd with the file system type "autofs".
740027
When the resource is used later on, then the wanted file system is
740027
mounted over that mount point on demand.
740027
'df -l' triggered systemd to mount the file system because it called
740027
stat() on the mount point.
740027
Instead of single-casing "autofs" targets, we can avoid stat()ing
740027
all dummy file systems (which includes "autofs"), because those are
740027
skipped later on in get_dev() anyway.
740027
740027
*src/df.c (filter_mount_list): Also skip dummy file systems unless
740027
the -a option or a specific target are given.
740027
* NEWS: Mention the fix.
740027
740027
Co-authored-by: Bernhard Voelker <mail@bernhard-voelker.de>
740027
740027
Fixes http://bugzilla.suse.com/show_bug.cgi?id=1043059
740027
740027
Upstream-commit: a19ff5d8179a7de38109fc78278229fd96f3941a
740027
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
740027
---
740027
 src/df.c | 1 +
740027
 1 file changed, 1 insertion(+)
740027
740027
diff --git a/src/df.c b/src/df.c
740027
index c50aa80..fa20493 100644
740027
--- a/src/df.c
740027
+++ b/src/df.c
740027
@@ -632,6 +632,7 @@ filter_mount_list (bool devices_only)
740027
          On Linux we probably have me_dev populated from /proc/self/mountinfo,
740027
          however we still stat() in case another device was mounted later.  */
740027
       if ((me->me_remote && show_local_fs)
740027
+          || (me->me_dummy && !show_all_fs && !show_listed_fs)
740027
           || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type))
740027
           || -1 == stat (me->me_mountdir, &buf))
740027
         {
740027
-- 
740027
2.17.2
740027