Debian Bug report logs - #563254
du: bind mount causes corrupted filesystem warning (despite -x !)

version graph

Package: coreutils; Maintainer for coreutils is Michael Stone <[email protected]>; Source for coreutils is src:coreutils (PTS, buildd, popcon).

Reported by: Alan Jenkins <[email protected]>

Date: Fri, 1 Jan 2010 14:12:02 UTC

Severity: normal

Found in version coreutils/8.1-1

Reply or subscribe to this bug.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to [email protected], [email protected], Michael Stone <[email protected]>:
Bug#563254; Package coreutils. (Fri, 01 Jan 2010 14:12:05 GMT) (full text, mbox, link).


Acknowledgement sent to Alan Jenkins <[email protected]>:
New Bug report received and forwarded. Copy sent to [email protected], Michael Stone <[email protected]>. (Fri, 01 Jan 2010 14:12:05 GMT) (full text, mbox, link).


Message #5 received at [email protected] (full text, mbox, reply):

From: Alan Jenkins <[email protected]>
To: Debian Bug Tracking System <[email protected]>
Subject: du: bind mount causes corrupted filesystem warning (despite -x !)
Date: Fri, 01 Jan 2010 14:09:00 +0000
Package: coreutils
Version: 8.1-1
Severity: normal


To reproduce:

$ mkdir -p /mnt/root
$ mount --bind / /mnt/root

(I have this in /etc/fstab...
 it lets me access parts of / which are hidden by other mounted filesystems - 
 this happens to be useful for reasons too long and obscure to be worth explaining)

$ du -x
du: WARNING: Circular directory structure.
This almost certainly means that you have a corrupted file system.
NOTIFY YOUR SYSTEM MANAGER.
The following directory is part of the cycle:
  `./mnt/root'
....


-- System Information:
Debian Release: squeeze/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (500, 'stable')
Architecture: i386 (i686)

Kernel: Linux 2.6.33-rc1eeepc-test3 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages coreutils depends on:
ii  libacl1                       2.2.49-1   Access control list shared library
ii  libattr1                      1:2.4.44-1 Extended attribute shared library
ii  libc6                         2.10.2-2   GNU C Library: Shared libraries
ii  libselinux1                   2.0.89-4   SELinux runtime shared libraries

coreutils recommends no packages.

coreutils suggests no packages.

-- no debconf information




Information forwarded to [email protected], Michael Stone <[email protected]>:
Bug#563254; Package coreutils. (Fri, 01 Jan 2010 17:57:09 GMT) (full text, mbox, link).


Acknowledgement sent to Jim Meyering <[email protected]>:
Extra info received and forwarded to list. Copy sent to Michael Stone <[email protected]>. (Fri, 01 Jan 2010 17:57:09 GMT) (full text, mbox, link).


Message #10 received at [email protected] (full text, mbox, reply):

From: Jim Meyering <[email protected]>
To: Alan Jenkins <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: Bug#563254: du: bind mount causes corrupted filesystem warning (despite -x !)
Date: Fri, 01 Jan 2010 18:39:26 +0100
Alan Jenkins wrote:
> Package: coreutils
> Version: 8.1-1
> Severity: normal
>
>
> To reproduce:
>
> $ mkdir -p /mnt/root
> $ mount --bind / /mnt/root
>
> (I have this in /etc/fstab...
>  it lets me access parts of / which are hidden by other mounted filesystems -
>  this happens to be useful for reasons too long and obscure to be worth explaining)
>
> $ du -x
> du: WARNING: Circular directory structure.
> This almost certainly means that you have a corrupted file system.
> NOTIFY YOUR SYSTEM MANAGER.
> The following directory is part of the cycle:
>   `./mnt/root'
> ....

Thanks for the report.
I confirm that this still happens with the latest.

For now, I suggest you use e.g.,

    du --exclude=/mnt -x /

Unless such bind mounts appear to be common,
I may just leave the current semantics as they are.

By the way, would you want du to traverse each
root partition directory twice?




Information forwarded to [email protected], Michael Stone <[email protected]>:
Bug#563254; Package coreutils. (Fri, 01 Jan 2010 21:06:06 GMT) (full text, mbox, link).


Acknowledgement sent to Alan Jenkins <[email protected]>:
Extra info received and forwarded to list. Copy sent to Michael Stone <[email protected]>. (Fri, 01 Jan 2010 21:06:07 GMT) (full text, mbox, link).


Message #15 received at [email protected] (full text, mbox, reply):

From: Alan Jenkins <[email protected]>
To: Jim Meyering <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: Bug#563254: du: bind mount causes corrupted filesystem warning (despite -x !)
Date: Fri, 01 Jan 2010 21:03:16 +0000
Jim Meyering wrote:
> Alan Jenkins wrote:
>   
>> Package: coreutils
>> Version: 8.1-1
>> Severity: normal
>>
>>
>> To reproduce:
>>
>> $ mkdir -p /mnt/root
>> $ mount --bind / /mnt/root
>>
>> (I have this in /etc/fstab...
>>  it lets me access parts of / which are hidden by other mounted filesystems -
>>  this happens to be useful for reasons too long and obscure to be worth explaining)
>>
>> $ du -x
>> du: WARNING: Circular directory structure.
>> This almost certainly means that you have a corrupted file system.
>> NOTIFY YOUR SYSTEM MANAGER.
>> The following directory is part of the cycle:
>>   `./mnt/root'
>> ....
>>     
>
> Thanks for the report.
> I confirm that this still happens with the latest.
>
> For now, I suggest you use e.g.,
>
>     du --exclude=/mnt -x /
>
> Unless such bind mounts appear to be common,
> I may just leave the current semantics as they are.
>
> By the way, would you want du to traverse each
> root partition directory twice?
>   

No.  I was thinking that -x would treat bind mounts like other mounts, 
and not traverse them.

I guess the problem is that -x is taken to mean "stay on this 
_filesystem_ only", as opposed to "stay on this _mount_ only".

And "stay on this filesystem" is probably easier to implement; you just 
check st_dev.  "Stay on this mount" requires checking /etc/mtab or 
/proc/mounts.

It doesn't seem too hard to add an extra check before printing the 
warning.  But I agree this is probably obscure, so I don't blame you for 
not being very bothered about it :-).

Thanks
Alan




Information forwarded to [email protected], Michael Stone <[email protected]>:
Bug#563254; Package coreutils. (Fri, 01 Jan 2010 21:36:03 GMT) (full text, mbox, link).


Acknowledgement sent to Jim Meyering <[email protected]>:
Extra info received and forwarded to list. Copy sent to Michael Stone <[email protected]>. (Fri, 01 Jan 2010 21:36:03 GMT) (full text, mbox, link).


Message #20 received at [email protected] (full text, mbox, reply):

From: Jim Meyering <[email protected]>
To: Alan Jenkins <[email protected]>
Cc: [email protected], [email protected]
Subject: Re: Bug#563254: du: bind mount causes corrupted filesystem warning (despite -x !)
Date: Fri, 01 Jan 2010 22:30:51 +0100
Alan Jenkins wrote:
> Jim Meyering wrote:
>> Alan Jenkins wrote:
>>
>>> Package: coreutils
>>> Version: 8.1-1
>>> Severity: normal
>>>
>>>
>>> To reproduce:
>>>
>>> $ mkdir -p /mnt/root
>>> $ mount --bind / /mnt/root
>>>
>>> (I have this in /etc/fstab...
>>>  it lets me access parts of / which are hidden by other mounted filesystems -
>>>  this happens to be useful for reasons too long and obscure to be worth explaining)
>>>
>>> $ du -x
>>> du: WARNING: Circular directory structure.
>>> This almost certainly means that you have a corrupted file system.
>>> NOTIFY YOUR SYSTEM MANAGER.
>>> The following directory is part of the cycle:
>>>   `./mnt/root'
>>> ....
>>>
>>
>> Thanks for the report.
>> I confirm that this still happens with the latest.
>>
>> For now, I suggest you use e.g.,
>>
>>     du --exclude=/mnt -x /
>>
>> Unless such bind mounts appear to be common,
>> I may just leave the current semantics as they are.
>>
>> By the way, would you want du to traverse each
>> root partition directory twice?
>>
>
> No.  I was thinking that -x would treat bind mounts like other mounts,
> and not traverse them.
>
> I guess the problem is that -x is taken to mean "stay on this
> _filesystem_ only", as opposed to "stay on this _mount_ only".
>
> And "stay on this filesystem" is probably easier to implement; you
> just check st_dev.  "Stay on this mount" requires checking /etc/mtab
> or /proc/mounts.
>
> It doesn't seem too hard to add an extra check before printing the
> warning.  But I agree this is probably obscure, so I don't blame you
> for not being very bothered about it :-).

Eventually we'll probably do precisely that, and merely warn
(or maybe suppress or water-down the diagnostic), rather than failing.




Information forwarded to [email protected], Michael Stone <[email protected]>:
Bug#563254; Package coreutils. (Tue, 21 Aug 2012 19:06:14 GMT) (full text, mbox, link).


Acknowledgement sent to Jim Meyering <[email protected]>:
Extra info received and forwarded to list. Copy sent to Michael Stone <[email protected]>. (Tue, 21 Aug 2012 19:06:14 GMT) (full text, mbox, link).


Message #25 received at [email protected] (full text, mbox, reply):

From: Jim Meyering <[email protected]>
To: [email protected]
Subject: Re: du bogus warning with bind mounts
Date: Tue, 21 Aug 2012 19:51:53 +0200
[Re: http://bugs.gnu.org/11844
 du: continue processing after bind-mount induced dir-cycle ]

Ondrej Oprala wrote:
> Sure, that looks great. Thanks for the help.

I added this to the log:

    * THANKS.in: Update.
    This implements the proposal in http://bugs.gnu.org/11844.
    Originally reported in http://bugs.debian.org/563254 by Alan Jenkins
    and more recently as http://bugzilla.redhat.com/836557

and pushed:
http://git.sv.gnu.org/cgit/coreutils.git/commit/?id=cf7e1b5b8fb53aef2a9103a32



Send a report that this bug log contains spam.


Debian bug tracking system administrator <[email protected]>. Last modified: Tue May 13 09:16:26 2025; Machine Name: buxtehude

Debian Bug tracking system

Debbugs is free software and licensed under the terms of the GNU General Public License version 2. The current version can be obtained from https://bugs.debian.org/debbugs-source/.

Copyright © 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson, 2005-2017 Don Armstrong, and many other contributors.