[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20260210015816.GQ7686@frogsfrogsfrogs>
Date: Mon, 9 Feb 2026 17:58:16 -0800
From: "Darrick J. Wong" <djwong@...nel.org>
To: Theodore Tso <tytso@....edu>
Cc: 294772273 <zy931031@....qq.com>,
linux-ext4 <linux-ext4@...r.kernel.org>,
"adilger.kernel" <adilger.kernel@...ger.ca>
Subject: Re: [QUESTION] ext4: Why does fsconfig allow repeated mounting?
On Mon, Feb 09, 2026 at 01:38:22PM -0500, Theodore Tso wrote:
> On Tue, Feb 10, 2026 at 12:07:27AM +0800, 294772273 wrote:
>
> > The mount interface will report an error for repeated mounting, but
> > fsconfig seems to allow this. Why is that?
>
> The mount interface does allow repeated mounting:
>
> root@...-xfstests:~# mount /dev/vdc /vdc
> [248226.221469] EXT4-fs (vdc): mounted filesystem 06dd464f-1c3a-4a2b-b3dd-e937c1e7
> 624f r/w with ordered data mode. Quota mode: none.
> root@...-xfstests:~# mount /dev/vdc /vdc
> root@...-xfstests:~# grep vdc /proc/mounts
> /dev/vdc /vdc ext4 rw,relatime 0 0
> /dev/vdc /vdc ext4 rw,relatime 0 0
>
> This is related to mounting the same block device in multiple places:
>
> root@...-xfstests:~# mount /dev/vdc /mnt/b
> root@...-xfstests:~# grep vdc /proc/mounts
> /dev/vdc /mnt/a ext4 rw,relatime 0 0
> /dev/vdc /mnt/b ext4 rw,relatime 0 0
> root@...-xfstests:~#
>
> ... which in turn is related to using bind mounts:
>
> root@...-xfstests:~# mount /dev/vdc /mnt/a
> [248574.078106] EXT4-fs (vdc): mounted filesystem 06dd464f-1c3a-4a2b-b3dd-e937c1
> e7624f r/w with ordered data mode. Quota mode: none.
> root@...-xfstests:~# mount --bind /mnt/a /mnt/b
> root@...-xfstests:~# grep vdc /proc/mounts
> /dev/vdc /mnt/a ext4 rw,relatime 0 0
> /dev/vdc /mnt/b ext4 rw,relatime 0 0
> root@...-xfstests:~#
>
> In both of these cases, you have to unmount the file system all of the
> mount points (and if applicable, in all namespaces) before the struct
> super for the block device is really unmounted.
>
> root@...-xfstests:~# umount /mnt/a
> root@...-xfstests:~# umount /mnt/b
> [248743.872394] EXT4-fs (vdc): unmounting filesystem 06dd464f-1c3a-4a2b-b3dd-e937c1e7624f.
> root@...-xfstests:~#
This is a fun new feature of the post-fsconfig mount(8) binary, as I
discovered when some of my newer fstests exploded after the D12->13
transition.
--D
> - Ted
>
Powered by blists - more mailing lists