From unknown Sun Jun 15 08:40:20 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#49298 <49298@debbugs.gnu.org> To: bug#49298 <49298@debbugs.gnu.org> Subject: Status: [PATCH] df: do not print duplicated entires with NFS and bind mounts Reply-To: bug#49298 <49298@debbugs.gnu.org> Date: Sun, 15 Jun 2025 15:40:20 +0000 retitle 49298 [PATCH] df: do not print duplicated entires with NFS and bind= mounts reassign 49298 coreutils submitter 49298 Kamil Dudka severity 49298 normal tag 49298 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Wed Jun 30 11:53:42 2021 Received: (at submit) by debbugs.gnu.org; 30 Jun 2021 15:53:42 +0000 Received: from localhost ([127.0.0.1]:58550 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWz-000683-KN for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:35782) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lycWx-00067u-3r for submit@debbugs.gnu.org; Wed, 30 Jun 2021 11:53:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:41616) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWw-00074f-Qp for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:38 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:58784) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lycWr-000141-W5 for bug-coreutils@gnu.org; Wed, 30 Jun 2021 11:53:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1625068411; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=iUXyGLtW+6qV+v8NddUwC/ENQKzay2srT0jg/BqByFY=; b=TrjuqOZnEH+frmTjf4zR3q7uvRlAeUhHmHgjWwe7Z08OSV6HOEQ1IjqKaAO3D+vW1RONNP iNvQW5D3sJId8KulcI8BHpUZm64/rt+vWUaqi2oOWME9ipuUb/xlN0++tL0pzQraDL1i0o CukXyjyZGYyzI1Kg4yJ7Eb1BqXdqSFc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-360-8xtNT4AvNGeBkeKkNgPhFA-1; Wed, 30 Jun 2021 11:53:28 -0400 X-MC-Unique: 8xtNT4AvNGeBkeKkNgPhFA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id B9E1C100CEC2 for ; Wed, 30 Jun 2021 15:53:27 +0000 (UTC) Received: from localhost.localdomain (unknown [10.43.7.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id E49F519C79; Wed, 30 Jun 2021 15:53:23 +0000 (UTC) From: Kamil Dudka To: bug-coreutils@gnu.org Subject: [PATCH] df: do not print duplicated entires with NFS and bind mounts Date: Wed, 30 Jun 2021 17:53:22 +0200 Message-Id: <20210630155322.149629-1-kdudka@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kdudka@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Received-SPF: pass client-ip=170.10.133.124; envelope-from=kdudka@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -31 X-Spam_score: -3.2 X-Spam_bar: --- X-Spam_report: (-3.2 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.435, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.4 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.4 (--) As originally reported in , 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 From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 02 02:24:43 2021 Received: (at submit) by debbugs.gnu.org; 2 Jul 2021 06:24:43 +0000 Received: from localhost ([127.0.0.1]:34040 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzCbT-0002Oz-96 for submit@debbugs.gnu.org; Fri, 02 Jul 2021 02:24:43 -0400 Received: from lists.gnu.org ([209.51.188.17]:56592) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzCbR-0002Os-Ql for submit@debbugs.gnu.org; Fri, 02 Jul 2021 02:24:42 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:53004) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzCbR-0007Jo-Hy for bug-coreutils@gnu.org; Fri, 02 Jul 2021 02:24:41 -0400 Received: from ishtar.tlinx.org ([173.164.175.65]:43232 helo=Ishtar.sc.tlinx.org) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lzCbP-0000NN-F3 for bug-coreutils@gnu.org; Fri, 02 Jul 2021 02:24:41 -0400 Received: from [192.168.3.12] (Athenae [192.168.3.12]) by Ishtar.sc.tlinx.org (8.14.7/8.14.4/SuSE Linux 0.8) with ESMTP id 1626OB13001632; Thu, 1 Jul 2021 23:24:13 -0700 Message-ID: <60DEB0D1.7090708@tlinx.org> Date: Thu, 01 Jul 2021 23:23:13 -0700 From: L A Walsh User-Agent: Thunderbird 2.0.0.24 (Windows/20100228) MIME-Version: 1.0 Subject: Re: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts References: <20210630155322.149629-1-kdudka@redhat.com> In-Reply-To: <20210630155322.149629-1-kdudka@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Received-SPF: pass client-ip=173.164.175.65; envelope-from=coreutils@tlinx.org; helo=Ishtar.sc.tlinx.org X-Spam_score_int: -8 X-Spam_score: -0.9 X-Spam_bar: / X-Spam_report: (-0.9 / 5.0 requ) BAYES_00=-1.9, MISSING_HEADERS=1.021, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-Spam-Score: -0.1 (/) X-Debbugs-Envelope-To: submit Cc: Kamil Dudka , Coreutils X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.1 (-) 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". From debbugs-submit-bounces@debbugs.gnu.org Fri Jul 02 11:07:50 2021 Received: (at 49298-done) by debbugs.gnu.org; 2 Jul 2021 15:07:50 +0000 Received: from localhost ([127.0.0.1]:36872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzKli-0002j9-EG for submit@debbugs.gnu.org; Fri, 02 Jul 2021 11:07:50 -0400 Received: from mail-wr1-f53.google.com ([209.85.221.53]:45736) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lzKle-0002iv-Sc for 49298-done@debbugs.gnu.org; Fri, 02 Jul 2021 11:07:49 -0400 Received: by mail-wr1-f53.google.com with SMTP id j2so12825901wrs.12 for <49298-done@debbugs.gnu.org>; Fri, 02 Jul 2021 08:07:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=12zArSiA77AeftgvUmZqVWRYwuPLA0/Z3/MqsMv17lI=; b=mgn0JWGe1cOdJ2T0nmBfVyItDCrijgmeFKsblbjXfFsJODAzzsSaSBQqafJvIsFm/1 x1Oz92Zb5aXaBI4Fi0d4xN5pZFRhhfwMgYQUWXMCueJ0WqCfqbH5g3x+xv1p5CuMziJy DZZ2+dl7FQ4zyjS6NTaoTIRlEqDOtWhNKBBmScT7350Vo3o1s4SZK+eMD4zJ/jQDy/wA axLTw1uIKETlpFqVNm72kh7yJyGvbng32wok0BeKwqQNJtqEY+ngjKAjL+fDZDK2QUdY zoIFvWnDfTXSrpCOohWHvDvxiSVBtb8Mwct2WL8oaVsHuCA+o0VZ61U3NcloJRqzupIo hXHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=12zArSiA77AeftgvUmZqVWRYwuPLA0/Z3/MqsMv17lI=; b=hLUjIrkNEYCs1y+lXp9gEOEnXRW9pP4U70jIbqJ0WwhyR5DxzOXowHkCVQzbcF2FFx s93VtXX7zkdKYGUJTbzMt3C7uHtUyTFQwmDuIvmytNg1WHdBD0JYD8At+hA5zKU1y80y Z0YoWv8Zjj94nao8PEckxTXZVyCKKKnHgEseWA3pNl6o2MkKw0+YQqRH1Upexb5jb/5E 0n4zBStOFc2zlNfjmLIMyavaGnPRMWY3luggQxJu3iom6EMQaZIGkrURwefqsOj/svpK UNUfc4PfmoTxAYwt2cr0eiVOBQeOP/Fql3Ey0F/d2MLJPFL+4MF2l4uTiAah/iq8bzMR MmhQ== X-Gm-Message-State: AOAM532VBo0ubcoNMslMbG/fbKevVrwbqsIdjfOkTfdSdkEFBbAATyli gJxbuJOCTRkR6VUEjFZIUcUq8RN/XancSQ== X-Google-Smtp-Source: ABdhPJyi6TP0ZYm5W+OCgWHczXWntmZ3aQTmEt5Dug1tn+nqIXX/p3ZCKSSrcJdrSj9kCRDkRNmjhw== X-Received: by 2002:a5d:424d:: with SMTP id s13mr99964wrr.9.1625238460886; Fri, 02 Jul 2021 08:07:40 -0700 (PDT) Received: from localhost.localdomain (86-42-15-3-dynamic.agg2.lod.rsl-rtd.eircom.net. [86.42.15.3]) by smtp.googlemail.com with UTF8SMTPSA id o11sm12698652wmc.2.2021.07.02.08.07.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 02 Jul 2021 08:07:40 -0700 (PDT) Subject: Re: bug#49298: [PATCH] df: do not print duplicated entires with NFS and bind mounts To: Kamil Dudka , 49298-done@debbugs.gnu.org References: <20210630155322.149629-1-kdudka@redhat.com> From: =?UTF-8?Q?P=c3=a1draig_Brady?= Message-ID: Date: Fri, 2 Jul 2021 16:07:38 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:84.0) Gecko/20100101 Thunderbird/84.0 MIME-Version: 1.0 In-Reply-To: <20210630155322.149629-1-kdudka@redhat.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Score: 0.5 (/) X-Debbugs-Envelope-To: 49298-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.5 (/) On 30/06/2021 16:53, Kamil Dudka wrote: > As originally reported in , > 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 From unknown Sun Jun 15 08:40:20 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Sat, 31 Jul 2021 11:24:07 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator