Subject: bug#66441: df: duplicated NFS4 bind mounts with the same device

From: Lukáš Zaoral <[email-masked]>
Date: Tue, 10 Oct 2023 13:57:55 +0200

I get duplicates on this reproducer with plain df, i.e. without -a.
Originally, the issue was reported for RHEL 8 [1] but I can reproduce
it even on the latest stable release of coreutils shipped with Fedora
Rawhide.

$ mkdir -p /original /bind1 /bind2
$ mount.nfs server:/nfs /original -v 
mount.nfs: timeout set for Fri Mar 10 10:50:59 2023
mount.nfs: trying text-based options 'vers=4.2,addr=192.168.122.40,clientaddr=192.168.122.121'
$ mount --bind /original/testd1 /bind1 -v
mount: /original/testd1 bound on /bind1.
$ mount --bind /original/testd2 /bind2 -v
mount: /original/testd2 bound on /bind2.
$ df -ht nfs4 
Filesystem Size Used Avail Use% Mounted on
server:/nfs 97M 5.4M 92M 6% /original
server:/nfs/testd1 97M 5.4M 92M 6% /bind1 
server:/nfs/testd2 97M 5.4M 92M 6% /bind2
$ mount --bind /original/testd1 /bind1 -v
mount: /original/testd1 bound on /bind1.
$ mount --bind /original/testd2 /bind2 -v
mount: /original/testd2 bound on /bind2.
$ df -ht nfs4
Filesystem Size Used Avail Use% Mounted on
server:/nfs 97M 5.4M 92M 6% /original
server:/nfs/testd1 97M 5.4M 92M 6% /bind1 
server:/nfs/testd2 97M 5.4M 92M 6% /bind2 
server:/nfs/testd1 97M 5.4M 92M 6% /bind1 <- dup
server:/nfs/testd2 97M 5.4M 92M 6% /bind2 <— dup

[1] https://issues.redhat.com/browse/RHEL-5649