RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1798030 - df --local should exclude AFS , SMB3 and GPFS filesystems.
Summary: df --local should exclude AFS , SMB3 and GPFS filesystems.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: coreutils
Version: 8.4
Hardware: All
OS: Linux
unspecified
low
Target Milestone: rc
: 8.0
Assignee: Kamil Dudka
QA Contact: Radka Brychtova
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-02-04 12:16 UTC by Kenneth D'souza
Modified: 2023-12-15 17:16 UTC (History)
4 users (show)

Fixed In Version: coreutils-8.30-8.el8
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-11-04 01:37:10 UTC
Type: Bug
Target Upstream Version:
Embargoed:
pm-rhel: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4454 0 None None None 2020-11-04 01:37:21 UTC

Description Kenneth D'souza 2020-02-04 12:16:48 UTC
Description of problem:
Currently df -l would only exclude a limited set of filesystems(nfs,cifs,smbfs and autofs with --hosts)  which are hard coded. 
Hence other filesystems would still be listed when df -l is run even though they are shared or remote filesystems.

Version-Release number of selected component (if applicable):
All:

How reproducible:
Always:

Steps to Reproduce:
1. Create an AFS or GPFS filesystem and mount it

2. Run df -l 

Actual results:

# df -l | less
/dev/sda2                              588352        276600       268744  51% /boot
remote-staas-fs1                1333217886208  764695533568 568522352640  58% /gpfs/slac/staas/fs1

Expected results:
# df -l | less
/dev/sda2                              588352        276600       268744  51% /boot

Only local filesystems should be listed. 

Additional info:

Currently the filesystems are hard coded and in lib/mountlist.c:

From upstream gnulib source code:

# less lib/mountlist.c 
#ifndef ME_REMOTE
/* A file system is "remote" if its Fs_name contains a ':'
   or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
   or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).  */
# define ME_REMOTE(Fs_name, Fs_type)            \
    (strchr (Fs_name, ':') != NULL              \
     || ((Fs_name)[0] == '/'                    \
         && (Fs_name)[1] == '/'                 \
         && (strcmp (Fs_type, "smbfs") == 0     \
             || strcmp (Fs_type, "cifs") == 0)) \
     || (strcmp("-hosts", Fs_name) == 0))
#endif

We can always add more filesystems to the above code but I am not sure if that's a good idea. As there are many remote/shared filesystem out there adding each filesystem to the above code would not be fruitful.

Comment 2 Kamil Dudka 2020-02-04 13:57:58 UTC
(In reply to Kenneth D'souza from comment #0)
> Version-Release number of selected component (if applicable):
> All:

Please always tell us the exact build (e.g. coreutils-8.22-24.el7) you tested it with.  Even if all versions were affected now, it might not be true when someone tries to reproduce the bug few years later.

> Actual results:
> 
> # df -l | less
> /dev/sda2                              588352        276600       268744 
> 51% /boot
> remote-staas-fs1                1333217886208  764695533568 568522352640 
> 58% /gpfs/slac/staas/fs1

Could you please paste the output of df --print-type ...?

> We can always add more filesystems to the above code but I am not sure if
> that's a good idea. As there are many remote/shared filesystem out there
> adding each filesystem to the above code would not be fruitful.

Yes, it sounds like we should add more patterns to this logic.

Note that AFS should now be supported by `stat` and `tail` since bug #1659530 is fixed.

Comment 3 Kenneth D'souza 2020-02-05 13:00:44 UTC
# rpm -q coreutils
coreutils-8.30-6.el8.x86_64

# df --print-type 

your-file-system.com:root.cell     afs      6813657088      254
6813656834   1% /afs/your-file-system.com

your-file-system.com:amd64_linux26 afs        20971520        6
20971514   1% /afs/your-file-system.com/amd64_linux26

The AFS patch has been posted upstream.

https://lists.gnu.org/archive/html/bug-gnulib/2020-02/txttTmHgwFcxo.txt 

From 5f47c372cd94867ce8a303e5ddba38b7e4bc6d8b Mon Sep 17 00:00:00 2001
From: Marc Dionne <address@hidden>
Date: Tue, 4 Feb 2020 11:40:05 -0400
Subject: [PATCH] mountlist: Consider AFS filesystems as remote

df --local relies on the ME_REMOTE macro to determine if a given
mount entry should be considered "local".  There is special logic
for nfs and smb/cifs mounts, but /afs as mounted by OpenAFS, the
kernel's kafs module or AuriStorFS is treated as a local mount.

Add some logic to treat mounts of type 'afs' (OpenAFS, kernel kafs)
and 'auristorfs' (AuriStorFS) as remote.

Signed-off-by: Marc Dionne <address@hidden>
---
 lib/mountlist.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/mountlist.c b/lib/mountlist.c
index 61063ce91..255e350e0 100644
--- a/lib/mountlist.c
+++ b/lib/mountlist.c
@@ -221,6 +221,7 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
 #ifndef ME_REMOTE
 /* A file system is "remote" if its Fs_name contains a ':'
    or if (it is of type (smbfs or cifs) and its Fs_name starts with '//')
+   or if it is of type (afs or auristorfs)
    or Fs_name is equal to "-hosts" (used by autofs to mount remote fs).  */
 # define ME_REMOTE(Fs_name, Fs_type)            \
     (strchr (Fs_name, ':') != NULL              \
@@ -228,6 +229,8 @@ me_remote (char const *fs_name, char const *fs_type _GL_UNUSED)
          && (Fs_name)[1] == '/'                 \
          && (strcmp (Fs_type, "smbfs") == 0     \
              || strcmp (Fs_type, "cifs") == 0)) \
+     || strcmp (Fs_type, "afs") == 0            \
+     || strcmp (Fs_type, "auristorfs") == 0     \
      || (strcmp("-hosts", Fs_name) == 0))
 #endif

Comment 5 Kamil Dudka 2020-02-05 13:31:52 UTC
(In reply to Kenneth D'souza from comment #3)
> The AFS patch has been posted upstream.
> 
> https://lists.gnu.org/archive/html/bug-gnulib/2020-02/txttTmHgwFcxo.txt 

Excellent.  Once it is merged upstream, we can pick it from there.

Comment 8 Kamil Dudka 2020-02-06 08:06:13 UTC
(In reply to Kamil Dudka from comment #5)
> Excellent.  Once it is merged upstream, we can pick it from there.

Upstream commit (does not include smb3):

https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=7a15069b

Comment 9 Kenneth D'souza 2020-02-06 08:30:58 UTC
(In reply to Kamil Dudka from comment #8)
> (In reply to Kamil Dudka from comment #5)
> > Excellent.  Once it is merged upstream, we can pick it from there.
> 
> Upstream commit (does not include smb3):
> 
> https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=7a15069b

Yes, as of now only afs patch has been picked.
The smb3 patch is yet to be reviewed.

Comment 12 Kamil Dudka 2020-02-09 12:04:42 UTC
(In reply to Kamil Dudka from comment #8)
> Upstream commit (does not include smb3):
> 
> https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=7a15069b

Upstream commit for smb3:

https://git.savannah.gnu.org/gitweb/?p=gnulib.git;a=commitdiff;h=4d4a22ab

Comment 35 errata-xmlrpc 2020-11-04 01:37:10 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (coreutils bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4454


Note You need to log in before you can comment on or make changes to this bug.