From: Gao Xiang <xiang@kernel.org>
To: Zhan Xusheng <zhanxusheng1024@gmail.com>
Cc: xiang@kernel.org, chao@kernel.org, zbestahu@gmail.com,
jefflexu@163.com, dhavale@google.com, hongbohbli@tencent.com,
guochunhai@vivo.com, giuseppe@scrivano.org,
linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org,
zhanxusheng@xiaomi.com
Subject: Re: [PATCH v2] erofs: don't reuse a superblock for a mount that passes device=
Date: Mon, 26 Oct 2026 11:40:37 +0100 [thread overview]
Message-ID: <at8uJdaEhdkZVsfY@MacBookPro> (raw)
In-Reply-To: <20261026092217.2129604-1-zhanxusheng1024@gmail.com>
On Mon, Oct 26, 2026 at 05:22:17PM +0800, Zhan Xusheng wrote:
> From: Zhan Xusheng <zhanxusheng@xiaomi.com>
>
> superblock_share together with device= is rejected in
> erofs_fc_fill_super():
>
> if (test_opt(&sbi->opt, SUPERBLOCK_SHARE) &&
> sbi->devs->extra_devices)
> return -EINVAL;
>
> but extra_devices is kept in sbi->devs, not in sbi->opt, and
> erofs_sb_share_test_super() compares only the backing inode, the
> fsoffset and sbi->opt. So once the image is mounted with
> superblock_share, a second mount with superblock_share,device= matches
> that superblock and get_tree_super() reuses it without calling
> fill_super() at all.
>
> The same command line therefore either fails with -EINVAL or succeeds
> with device= quietly dropped, depending on whether a compatible mount
> already exists.
>
> Refuse to match a context that brought device= options, so that it gets
> a superblock of its own and fill_super() decides as it does today.
>
> Only the incoming context can be tested: a shared superblock may have
> extra_devices set itself, because erofs_scan_devices() fills the device
> table from the image when no device= was given.
>
> Fixes: cd4108319bb3 ("erofs: reuse superblock for file-backed mounts")
> Signed-off-by: Zhan Xusheng <zhanxusheng@xiaomi.com>
Reviewed-by: Gao Xiang <xiang@kernel.org>
Also I will update the subject as "erofs: fix disallowing superblock_share
if device= is set".
Thanks,
Gao Xiang
prev parent reply other threads:[~2026-10-26 10:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-21 8:38 [PATCH] erofs: don't reuse a superblock for a mount that passes device= Zhan Xusheng
2026-10-26 8:49 ` Gao Xiang
2026-10-26 9:22 ` [PATCH v2] " Zhan Xusheng
2026-10-26 10:40 ` Gao Xiang [this message]
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=at8uJdaEhdkZVsfY@MacBookPro \
--to=xiang@kernel.org \
--cc=chao@kernel.org \
--cc=dhavale@google.com \
--cc=giuseppe@scrivano.org \
--cc=guochunhai@vivo.com \
--cc=hongbohbli@tencent.com \
--cc=jefflexu@163.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=zbestahu@gmail.com \
--cc=zhanxusheng1024@gmail.com \
--cc=zhanxusheng@xiaomi.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.