Subject: bug#12730: coreutils-8.20: FAIL: tests/du/bind-mount-dir-cycle.sh

From: Jim Meyering <[email-masked]>
Date: Thu, 25 Oct 2012 21:37:08 +0200

[email-masked] wrote:
...
>> To me, it looks like the *lack* of a line for the a/b mount
>> is the problem.  When you remove the symlink the mount command
>> does not update the regular-file /etc/mtab, so mount-listing
>> code cannot see that a/b is bind-mounted.
>>
> No, this is not a missing line but understanding that line content.
>
> To prove that, I started again with a new mtab,
> - mounted a/b without writting to mtab
> - copied to mtab a line content with a/b mounted exactly the same as
> in /proc/mounts case,
> - hash_lookup answer changed
> .
> [chroot-i486] root:/usr/src/coreutils-8.20$ rm -f /etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ grep '^\/dev.* / '
> /proc/mounts >/etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ mount -n --bind a a/b
> [chroot-i486] root:/usr/src/coreutils-8.20$ echo
> /dev/disk/by-uuid/7a235d64-5d04-41ac-a959-70465eb74fc8
> /usr/src/coreutils-8.20/a/b ext3
> rw,relatime,errors=remount-ro,barrier=1,data=ordered 0 0' >>/etc/mtab
> [chroot-i486] root:/usr/src/coreutils-8.20$ ./src/du a
> ./src/du: mount point 'a/b' already traversed
> 4       a

It sounds like you have confirmed my conclusion.
When you use a symlink, /etc/mtab contains a line for the a/b mount
and the mount-listing loop in fill_mount_table inserts an entry for a/b.
Later, when we search that table for the inode of "a/b", we find
that entry and know that it's a bind-mount, so issue only the minor
warning, rather than the "DISK CORRUPTION" warning.

With your regular mtab file, it contains no such a/b line, and
the mount-listing loop in fill_mount_table inserts no entry for a/b.
Later, when we search that table for a/b's inode, we find no entry
and have to report the more serious error.