summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaejun Park <daejun7.park@samsung.com>2026-11-03 15:29:32 +0900
committerGao Xiang <xiang@kernel.org>2026-11-04 10:49:59 +0100
commit7c26dc33ea7bb677db294bfb4e58d4207477c9e3 (patch)
tree7885bb2d1d0dd96c75dc0874f5d0d2a32f57b0d2
parente9aeaa63fd94b0d2bb9b303be5774b33ca9c01cf (diff)
erofs: treat files shared by inode_share as stacked
A file-backed mount whose image or extra device is on a block-backed EROFS passes erofs_is_stacked_file(). If inode_share shares that file, erofs_real_inode() may pick an inode of a file-backed EROFS in the same domain to read it. File-backed reads then nest in the same task. Treat files that use erofs_ishare_fops as stacked. Fixes: 34096ba919fd ("erofs: support unencoded inodes for page cache share") Reported-by: Sashiko <sashiko-bot@kernel.org> Link: https://sashiko.dev/#/patchset/20261030-erofs-fileio-bioset-v1-1-caf47adbb3a3@samsung.com Signed-off-by: Daejun Park <daejun7.park@samsung.com> Reviewed-by: Gao Xiang <xiang@kernel.org> Signed-off-by: Gao Xiang (Docker) <xiang@kernel.org>
-rw-r--r--fs/erofs/super.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/erofs/super.c b/fs/erofs/super.c
index ee01a5ef8593..e92a7fa90ae3 100644
--- a/fs/erofs/super.c
+++ b/fs/erofs/super.c
@@ -125,9 +125,12 @@ void *erofs_read_metadata(struct super_block *sb, struct erofs_buf *buf,
/* see the comment in erofs_fc_fill_super() */
static bool erofs_is_stacked_file(struct file *file)
{
- struct super_block *sb = file_inode(file)->i_sb;
+ struct inode *inode = file_inode(file);
+ struct super_block *sb = inode->i_sb;
- return (sb->s_op == &erofs_sops && !sb->s_bdev) || sb->s_stack_depth;
+ return (sb->s_op == &erofs_sops && !sb->s_bdev) || sb->s_stack_depth ||
+ (IS_ENABLED(CONFIG_EROFS_FS_PAGE_CACHE_SHARE) &&
+ inode->i_fop == &erofs_ishare_fops);
}
static int erofs_init_device(struct erofs_buf *buf, struct super_block *sb,
@@ -713,6 +716,9 @@ static int erofs_fc_fill_super(struct super_block *sb, struct fs_context *fc)
* EROFS is the only fs supporting file-backed mounts for now.
* It MUST change if another fs plans to support them, which
* may also require adjusting FILESYSTEM_MAX_STACK_DEPTH.
+ * Files shared by inode_share may be read through a
+ * file-backed EROFS in the same domain, so treat them as
+ * stacked too.
*/
if (erofs_is_stacked_file(sbi->dif0.file)) {
erofs_err(sb, "file-backed mounts cannot be applied to stacked fses");