From 9c4641f42bbecf63ec0a0e05caacbccd5332b831 Mon Sep 17 00:00:00 2001 From: Philipp Thomas Date: Sun, 26 Mar 2017 22:34:00 -0700 Subject: [PATCH] df: avoid querying excluded file systems * src/df.c (filter_mount_list): Avoid stat() on explicitly excluded file systems, which is especially significant in cases like `-x nfs` which may hang. * NEWS: Mention the bug fix. Upstream-commit: 7c228bc55ed3fd6d56a6ad135438066de2f54a30 Signed-off-by: Kamil Dudka --- src/df.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/df.c b/src/df.c index 5b9e8fd..e0ebed7 100644 --- a/src/df.c +++ b/src/df.c @@ -632,9 +632,11 @@ 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) + || (!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. + /* If remote, and showing just local, or FS type is excluded, + add ME for filtering later. If stat failed; add ME to be able to complain about it later. */ buf.st_dev = me->me_dev; } -- 2.13.6