public inbox for linux-ext4@vger.kernel.org
 help / color / mirror / Atom feed
From: "Theodore Tso" <tytso@mit.edu>
To: 294772273 <zy931031@vip.qq.com>
Cc: linux-ext4 <linux-ext4@vger.kernel.org>,
	"adilger.kernel" <adilger.kernel@dilger.ca>
Subject: Re: [QUESTION] ext4: Why does fsconfig allow repeated mounting?
Date: Mon, 9 Feb 2026 13:38:22 -0500	[thread overview]
Message-ID: <20260209183822.GA15302@macsyma.lan> (raw)
In-Reply-To: <tencent_2462A2D2BBD1792040E4BF74D8EE146E9D08@qq.com>

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

       reply	other threads:[~2026-02-09 18:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <tencent_2462A2D2BBD1792040E4BF74D8EE146E9D08@qq.com>
2026-02-09 18:38 ` Theodore Tso [this message]
2026-02-10  1:58   ` [QUESTION] ext4: Why does fsconfig allow repeated mounting? Darrick J. Wong

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260209183822.GA15302@macsyma.lan \
    --to=tytso@mit.edu \
    --cc=adilger.kernel@dilger.ca \
    --cc=linux-ext4@vger.kernel.org \
    --cc=zy931031@vip.qq.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox