Subject: Re: Bug#563254: du: bind mount causes corrupted filesystem warning (despite -x !)

From: Jim Meyering <[email-masked]>
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?