GNU bug report logs -
#49298
[PATCH] df: do not print duplicated entires with NFS and bind mounts
Previous Next
Reported by: Kamil Dudka <kdudka <at> redhat.com>
Date: Wed, 30 Jun 2021 15:54:01 UTC
Severity: normal
Tags: patch
Done: Pádraig Brady <P <at> draigBrady.com>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 49298 in the body.
You can then email your comments to 49298 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-coreutils <at> gnu.org
:
bug#49298
; Package
coreutils
.
(Wed, 30 Jun 2021 15:54:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Kamil Dudka <kdudka <at> redhat.com>
:
New bug report received and forwarded. Copy sent to
bug-coreutils <at> gnu.org
.
(Wed, 30 Jun 2021 15:54:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
As originally reported in <https://bugzilla.redhat.com/1962515>,
df invoked without -a printed duplicated entries for NFS mounts
of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99,
which introduced the use of a hash table.
The proposed patch makes sure that the devlist entry seen the last time
is used for comparison when eliminating duplicated mount entries. This
way it worked before introducing the hash table.
Patch co-authored by Roberto Bergantinos.
* src/ls.c (struct devlist): Introduce the seen_last pointer.
(devlist_for_dev): Return the devlist entry seen the last time if found.
(filter_mount_list): Remember the devlist entry seen the last time for
each hashed item.
---
src/df.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/src/df.c b/src/df.c
index aadc3483f22..16a7b5524df 100644
--- a/src/df.c
+++ b/src/df.c
@@ -54,6 +54,7 @@ struct devlist
dev_t dev_num;
struct mount_entry *me;
struct devlist *next;
+ struct devlist *seen_last; /* valid for hashed devlist entries only */
};
/* Filled with device numbers of examined file systems to avoid
@@ -681,7 +682,13 @@ devlist_for_dev (dev_t dev)
return NULL;
struct devlist dev_entry;
dev_entry.dev_num = dev;
- return hash_lookup (devlist_table, &dev_entry);
+
+ struct devlist *found = hash_lookup (devlist_table, &dev_entry);
+ if (found == NULL)
+ return NULL;
+
+ /* Return the last devlist entry we have seen with this dev_num */
+ return found->seen_last;
}
static void
@@ -799,8 +806,12 @@ filter_mount_list (bool devices_only)
devlist->dev_num = buf.st_dev;
devlist->next = device_list;
device_list = devlist;
- if (hash_insert (devlist_table, devlist) == NULL)
+
+ struct devlist *inserted = hash_insert (devlist_table, devlist);
+ if (inserted == NULL)
xalloc_die ();
+ /* Remember the last devlist entry we have seen with this dev_num */
+ inserted->seen_last = devlist;
me = me->me_next;
}
--
2.31.1
Information forwarded
to
bug-coreutils <at> gnu.org
:
bug#49298
; Package
coreutils
.
(Fri, 02 Jul 2021 06:25:02 GMT)
Full text and
rfc822 format available.
Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):
On 2021/06/30 08:53, Kamil Dudka wrote:
> The proposed patch makes sure that the devlist entry seen the last time
> is used for comparison when eliminating duplicated mount entries.
---
I'm a bit surprised that the devlists exported for NFS are the same
as for smb. How is that guaranteed? But more important, does it work with
other network file systems? Mostly I'm thinking about mounts of
NTFS from a win server. I've gotten different results over time,
specifically,
in regards to whether or not inode numbers are unique.
Would it be possible for the network file systems to return
different amounts for free+used space depending on the net-interface
being used (I don't know -- I'd hope it wasn't likely, but ....)
Another way of solving this issue, other than by special casing
SMB+NFS, a switch that prohibits crossing over to another networked
file system, and a different setting that prohibits crossing over to
another device. I think there is a need for both as well as how initial
args are treated -- as is done with 'find' in all its diversity! ;-)
Patches to reintroduce behaviors that might result in non-deterministic
behaviors are, at least, "worrisome".
Reply sent
to
Pádraig Brady <P <at> draigBrady.com>
:
You have taken responsibility.
(Fri, 02 Jul 2021 15:08:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Kamil Dudka <kdudka <at> redhat.com>
:
bug acknowledged by developer.
(Fri, 02 Jul 2021 15:08:02 GMT)
Full text and
rfc822 format available.
Message #13 received at 49298-done <at> debbugs.gnu.org (full text, mbox):
On 30/06/2021 16:53, Kamil Dudka wrote:
> As originally reported in <https://bugzilla.redhat.com/1962515>,
> df invoked without -a printed duplicated entries for NFS mounts
> of bind mounts. This is a regression from commit v8.25-54-g1c17f61ef99,
> which introduced the use of a hash table.
>
> The proposed patch makes sure that the devlist entry seen the last time
> is used for comparison when eliminating duplicated mount entries. This
> way it worked before introducing the hash table.
>
> Patch co-authored by Roberto Bergantinos.
>
> * src/ls.c (struct devlist): Introduce the seen_last pointer.
> (devlist_for_dev): Return the devlist entry seen the last time if found.
> (filter_mount_list): Remember the devlist entry seen the last time for
> each hashed item.
Indeed order is significant here as we can have multiple entries for the same dev nums.
The patch looks good and restores the ordering from before commit 1c17f61ef.
I'll will apply this.
Marking as done.
thanks!
Pádraig
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Sat, 31 Jul 2021 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 2 years and 261 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.