From: "Theodore Ts'o" <tytso@mit.edu>
To: zhanchengbin <zhanchengbin1@huawei.com>
Cc: linux-ext4@vger.kernel.org, liuzhiqiang26@huawei.com,
linfeilong@huawei.com
Subject: Re: [PATCH] resize2fs : resize2fs failed due to the same name of tmpfs
Date: Tue, 21 Dec 2021 15:57:42 -0500 [thread overview]
Message-ID: <YcI/xt1IiJKLN/Bw@mit.edu> (raw)
In-Reply-To: <54d44dbc-861d-8c49-9b29-2621c201ca4f@huawei.com>
On Tue, Nov 30, 2021 at 12:04:48PM +0800, zhanchengbin wrote:
> If there is a tmpfs with the same name as the disk, and mount before the
> disk,example:
> /dev/sdd /root/tmp tmpfs rw,seclabel,relatime 0 0
> /dev/sdd /root/mnt ext4 rw,seclabel,relatime 0 0
This should already be fixed e2fsprogs 1.45.5+ via this commit:
commit ea4d53b7b9079fd6e2cc34cf569a993a183bfbd2
Author: Theodore Ts'o <tytso@mit.edu>
Date: Sun Nov 10 12:11:49 2019 -0500
libext2fs/ismounted.c: check device id in advance to skip false device names
If there is a trickster which tries to use device names as the mount
device for pseudo-file systems, the resulting /proc/mounts can confuse
ext2fs_check_mount_point(). (So far as I can tell, there's no good
reason to do this, but sysadmins do the darnest things.)
An example of this might be the following /proc/mounts excerpt:
/dev/sdb /mnt2 tmpfs rw,relatime 0 0
/dev/sdb /mnt ext4 rw,relatime 0 0
This is created via "mount -t tmpfs /dev/sdb /mnt2" followed via
"mount -t ext4 /dev/sdb /mnt". (Normally, a sane mount of tmpfs would
use something like "mount -t tmpfs tmpfs /mnt2".)
Fix this by double checking the st_rdev of the claimed mountpoint and
match it with the dev_t of the device. (Note that the GNU HURD
doesn't support st_rdev, so we can't solve this problem for the HURD.)
Reported-by: GuiYao <guiyao@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
I've tested via tst_ismounted and I can't replicate the issue you've described.
% cd /build/e2fsprogs-maint/lib/ext2fs
% make tst_ismounted
% sudo ./tst_ismounted /dev/dm-7
Bogus entry in /proc/mounts! (/dev/dm-7 is not mounted on /root/tmp)
Device /dev/dm-7 reports flags 11
/dev/dm-7 is apparently in use.
/dev/dm-7 is mounted.
/dev/dm-7 is mounted on /root/mnt.
Cheers,
- Ted
next prev parent reply other threads:[~2021-12-21 20:57 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-30 4:04 [PATCH] resize2fs : resize2fs failed due to the same name of tmpfs zhanchengbin
2021-12-01 5:05 ` zhanchengbin
2021-12-21 20:57 ` Theodore Ts'o [this message]
2021-12-31 8:15 ` zhanchengbin
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=YcI/xt1IiJKLN/Bw@mit.edu \
--to=tytso@mit.edu \
--cc=linfeilong@huawei.com \
--cc=linux-ext4@vger.kernel.org \
--cc=liuzhiqiang26@huawei.com \
--cc=zhanchengbin1@huawei.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.