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