public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [QUESTION] ext4: Why does fsconfig allow repeated mounting?
       [not found] <tencent_2462A2D2BBD1792040E4BF74D8EE146E9D08@qq.com>
@ 2026-02-09 18:38 ` Theodore Tso
  2026-02-10  1:58   ` Darrick J. Wong
  0 siblings, 1 reply; 2+ messages in thread
From: Theodore Tso @ 2026-02-09 18:38 UTC (permalink / raw)
  To: 294772273; +Cc: linux-ext4, adilger.kernel

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@kvm-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@kvm-xfstests:~# mount /dev/vdc /vdc
root@kvm-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@kvm-xfstests:~# mount /dev/vdc /mnt/b
root@kvm-xfstests:~# grep vdc /proc/mounts
/dev/vdc /mnt/a ext4 rw,relatime 0 0
/dev/vdc /mnt/b ext4 rw,relatime 0 0
root@kvm-xfstests:~#

... which in turn is related to using bind mounts:

root@kvm-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@kvm-xfstests:~# mount --bind /mnt/a /mnt/b
root@kvm-xfstests:~# grep vdc /proc/mounts
/dev/vdc /mnt/a ext4 rw,relatime 0 0
/dev/vdc /mnt/b ext4 rw,relatime 0 0
root@kvm-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@kvm-xfstests:~# umount /mnt/a
root@kvm-xfstests:~# umount /mnt/b
[248743.872394] EXT4-fs (vdc): unmounting filesystem 06dd464f-1c3a-4a2b-b3dd-e937c1e7624f.
root@kvm-xfstests:~# 

						- Ted

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [QUESTION] ext4: Why does fsconfig allow repeated mounting?
  2026-02-09 18:38 ` [QUESTION] ext4: Why does fsconfig allow repeated mounting? Theodore Tso
@ 2026-02-10  1:58   ` Darrick J. Wong
  0 siblings, 0 replies; 2+ messages in thread
From: Darrick J. Wong @ 2026-02-10  1:58 UTC (permalink / raw)
  To: Theodore Tso; +Cc: 294772273, linux-ext4, adilger.kernel

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@kvm-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@kvm-xfstests:~# mount /dev/vdc /vdc
> root@kvm-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@kvm-xfstests:~# mount /dev/vdc /mnt/b
> root@kvm-xfstests:~# grep vdc /proc/mounts
> /dev/vdc /mnt/a ext4 rw,relatime 0 0
> /dev/vdc /mnt/b ext4 rw,relatime 0 0
> root@kvm-xfstests:~#
> 
> ... which in turn is related to using bind mounts:
> 
> root@kvm-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@kvm-xfstests:~# mount --bind /mnt/a /mnt/b
> root@kvm-xfstests:~# grep vdc /proc/mounts
> /dev/vdc /mnt/a ext4 rw,relatime 0 0
> /dev/vdc /mnt/b ext4 rw,relatime 0 0
> root@kvm-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@kvm-xfstests:~# umount /mnt/a
> root@kvm-xfstests:~# umount /mnt/b
> [248743.872394] EXT4-fs (vdc): unmounting filesystem 06dd464f-1c3a-4a2b-b3dd-e937c1e7624f.
> root@kvm-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
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-02-10  1:58 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <tencent_2462A2D2BBD1792040E4BF74D8EE146E9D08@qq.com>
2026-02-09 18:38 ` [QUESTION] ext4: Why does fsconfig allow repeated mounting? Theodore Tso
2026-02-10  1:58   ` Darrick J. Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox