f180de
From 9c4641f42bbecf63ec0a0e05caacbccd5332b831 Mon Sep 17 00:00:00 2001
f180de
From: Philipp Thomas <pth@suse.de>
f180de
Date: Sun, 26 Mar 2017 22:34:00 -0700
f180de
Subject: [PATCH 1/2] df: avoid querying excluded file systems
f180de
f180de
* src/df.c (filter_mount_list): Avoid stat() on
f180de
explicitly excluded file systems, which is especially
f180de
significant in cases like `-x nfs` which may hang.
f180de
* NEWS: Mention the bug fix.
f180de
f180de
Upstream-commit: 7c228bc55ed3fd6d56a6ad135438066de2f54a30
f180de
Signed-off-by: Kamil Dudka <kdudka@redhat.com>
f180de
---
f180de
 src/df.c | 4 +++-
f180de
 1 file changed, 3 insertions(+), 1 deletion(-)
f180de
f180de
diff --git a/src/df.c b/src/df.c
f180de
index 5b9e8fd..e0ebed7 100644
f180de
--- a/src/df.c
f180de
+++ b/src/df.c
f180de
@@ -632,9 +632,11 @@ filter_mount_list (bool devices_only)
f180de
          On Linux we probably have me_dev populated from /proc/self/mountinfo,
f180de
          however we still stat() in case another device was mounted later.  */
f180de
       if ((me->me_remote && show_local_fs)
f180de
+          || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type))
f180de
           || -1 == stat (me->me_mountdir, &buf))
f180de
         {
f180de
-          /* If remote, and showing just local, add ME for filtering later.
f180de
+          /* If remote, and showing just local, or FS type is excluded,
f180de
+             add ME for filtering later.
f180de
              If stat failed; add ME to be able to complain about it later.  */
f180de
           buf.st_dev = me->me_dev;
f180de
         }
f180de
-- 
f180de
2.13.6
f180de
f180de
f180de
From a4a61effe74766cdf047d6af52cf63613057bd87 Mon Sep 17 00:00:00 2001
f180de
From: Kamil Dudka <kdudka@redhat.com>
f180de
Date: Thu, 23 Nov 2017 17:30:09 +0100
f180de
Subject: [PATCH 2/2] df: limit the stat() call optimization for dummy file
f180de
 systems only
f180de
f180de
Otherwise 'df -t rootfs' mistakenly shows a dummy file system without
f180de
using the -a option, because the dummy file system is shadowed by the
f180de
actual root file system entry, for which we optimize out the stat()
f180de
call.
f180de
f180de
The problem fixed by this patch is not observable on Fedora because
f180de
/proc/self/mountinfo (which we do not use on RHEL) does not contain
f180de
the rootfs mount entry.
f180de
---
f180de
 src/df.c | 3 ++-
f180de
 1 file changed, 2 insertions(+), 1 deletion(-)
f180de
f180de
diff --git a/src/df.c b/src/df.c
f180de
index adade6d..4c6131e 100644
f180de
--- a/src/df.c
f180de
+++ b/src/df.c
f180de
@@ -632,7 +632,8 @@ filter_mount_list (bool devices_only)
f180de
          On Linux we probably have me_dev populated from /proc/self/mountinfo,
f180de
          however we still stat() in case another device was mounted later.  */
f180de
       if ((me->me_remote && show_local_fs)
f180de
-          || (!selected_fstype (me->me_type) || excluded_fstype (me->me_type))
f180de
+          || (me->me_dummy && (excluded_fstype (me->me_type)
f180de
+              || !selected_fstype (me->me_type)))
f180de
           || -1 == stat (me->me_mountdir, &buf))
f180de
         {
f180de
           /* If remote, and showing just local, or FS type is excluded,
f180de
-- 
f180de
2.13.6
f180de