]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
df: avoid stat() for dummy file systems with -l
authorJosef Cejka <jcejka@suse.com>
Mon, 31 Jul 2017 23:50:34 +0000 (01:50 +0200)
committerPádraig Brady <P@draigBrady.com>
Tue, 29 Aug 2017 06:22:28 +0000 (23:22 -0700)
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 <mail@bernhard-voelker.de>
Fixes http://bugzilla.suse.com/show_bug.cgi?id=1043059

NEWS
THANKS.in
src/df.c

diff --git a/NEWS b/NEWS
index d37195e2ddcf96b8970465d2db06c3f3fa494b7b..4c63397e7ce153e9c83092320c27baa404cc0998 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -37,6 +37,10 @@ GNU coreutils NEWS                                    -*- outline -*-
   specifying -x nfs no longer hangs with problematic nfs mounts.
   [bug introduced in coreutils-8.21]
 
+  df no longer interacts with dummy file system types, so for example
+  no longer hangs with problematic nfs mounted via system.automount(5).
+  [bug introduced in coreutils-8.21]
+
   `groups inva:lid root` no longer exits immediately upon failure.
   Now, it prints a diagnostic or a line to stdout for each argument.
   [bug introduced in the bourne-shell-to-C rewrite for coreutils-6.11]
index 7ce672bea34d02a9f7a339c9826836cb3eb9cf43..969bda07909748b1040788f2d366d6a13a646aac 100644 (file)
--- a/THANKS.in
+++ b/THANKS.in
@@ -321,7 +321,6 @@ Jon Peatfield                       J.S.Peatfield@damtp.cam.ac.uk
 Joost van Baal                      joostvb@xs4all.nl
 Jordi Pujol                         jordipujolp@gmail.com
 Jorge Stolfi                        stolfi@ic.unicamp.br
-Josef Cejka                         jcejka@suse.com
 Joseph D. Wagner                    joe@josephdwagner.info
 Joseph S. Myers                     jsm28@cam.ac.uk
 Josh Triplett                       josh@freedesktop.org
index 678aa47fd24dece33b5dbfd5c0f3741a3458ea8c..bd4cc8b3cc286e765b19dd475c95050909e171a4 100644 (file)
--- a/src/df.c
+++ b/src/df.c
@@ -674,6 +674,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))
         {