public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: driz2t <driz2t@qq.com>
To: stable <stable@vger.kernel.org>
Cc: xiang <xiang@kernel.org>, chao <chao@kernel.org>,
	jefflexu <jefflexu@linux.alibaba.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	syzbot+016d861797fd718491a8
	<syzbot+016d861797fd718491a8@syzkaller.appspotmail.com>
Subject: [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode()
Date: Wed, 25 Mar 2026 19:11:22 +0800	[thread overview]
Message-ID: <tencent_4CAC91CB31E29B2052C48E4A15D379060905@qq.com> (raw)

[ Upstream commit 4fdadd5b0f0c723c812842454f8cca1619f2e731 ]

Prior to big pclusters, non-compact compression indexes could have
empty headers.

Avoid the legacy path since it can be handled properly as a specific
compression header with z_erofs_fill_inode_lazy() too.

Tested with existing erofs-utils versions.

Link: https://lore.kernel.org/r/20230413092241.73829-1-hsiangkao@linux.alibaba.com
Link: https://syzkaller.appspot.com/bug?extid=016d861797fd718491a8
Reported-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Tested-by: syzbot+016d861797fd718491a8@syzkaller.appspotmail.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Changjian Liu <driz2t@qq.com>
---
 fs/erofs/inode.c    | 12 ++++++++----
 fs/erofs/internal.h |  2 --
 fs/erofs/zmap.c     | 18 ------------------
 3 files changed, 8 insertions(+), 24 deletions(-)

diff --git a/fs/erofs/inode.c b/fs/erofs/inode.c
index 3cbef6318b7b..484572504b4d 100644
--- a/fs/erofs/inode.c
+++ b/fs/erofs/inode.c
@@ -280,11 +280,15 @@ static int erofs_fill_inode(struct inode *inode)
 	}
 
 	if (erofs_inode_is_data_compressed(vi-&gt;datalayout)) {
+#ifdef CONFIG_EROFS_FS_ZIP
 		if (!erofs_is_fscache_mode(inode-&gt;i_sb) &amp;&amp;
-		    inode-&gt;i_sb-&gt;s_blocksize_bits == PAGE_SHIFT)
-			err = z_erofs_fill_inode(inode);
-		else
-			err = -EOPNOTSUPP;
+		    inode-&gt;i_sb-&gt;s_blocksize_bits == PAGE_SHIFT) {
+			inode-&gt;i_mapping-&gt;a_ops = &amp;z_erofs_aops;
+			err = 0;
+			goto out_unlock;
+		}
+#endif
+		err = -EOPNOTSUPP;
 		goto out_unlock;
 	}
 	inode-&gt;i_mapping-&gt;a_ops = &amp;erofs_raw_access_aops;
diff --git a/fs/erofs/internal.h b/fs/erofs/internal.h
index 126970932805..1a4d08a93339 100644
--- a/fs/erofs/internal.h
+++ b/fs/erofs/internal.h
@@ -423,12 +423,10 @@ enum {
 extern const struct iomap_ops z_erofs_iomap_report_ops;
 
 #ifdef CONFIG_EROFS_FS_ZIP
-int z_erofs_fill_inode(struct inode *inode);
 int z_erofs_map_blocks_iter(struct inode *inode,
 			    struct erofs_map_blocks *map,
 			    int flags);
 #else
-static inline int z_erofs_fill_inode(struct inode *inode) { return -EOPNOTSUPP; }
 static inline int z_erofs_map_blocks_iter(struct inode *inode,
 					  struct erofs_map_blocks *map,
 					  int flags)
diff --git a/fs/erofs/zmap.c b/fs/erofs/zmap.c
index d2d7fe826091..ff84533da0c4 100644
--- a/fs/erofs/zmap.c
+++ b/fs/erofs/zmap.c
@@ -7,24 +7,6 @@
 #include <asm unaligned.h="">
 #include <trace events="" erofs.h="">
 
-int z_erofs_fill_inode(struct inode *inode)
-{
-	struct erofs_inode *const vi = EROFS_I(inode);
-	struct erofs_sb_info *sbi = EROFS_SB(inode-&gt;i_sb);
-
-	if (!erofs_sb_has_big_pcluster(sbi) &amp;&amp;
-	    !erofs_sb_has_ztailpacking(sbi) &amp;&amp; !erofs_sb_has_fragments(sbi) &amp;&amp;
-	    vi-&gt;datalayout == EROFS_INODE_COMPRESSED_FULL) {
-		vi-&gt;z_advise = 0;
-		vi-&gt;z_algorithmtype[0] = 0;
-		vi-&gt;z_algorithmtype[1] = 0;
-		vi-&gt;z_logical_clusterbits = inode-&gt;i_sb-&gt;s_blocksize_bits;
-		set_bit(EROFS_I_Z_INITED_BIT, &amp;vi-&gt;flags);
-	}
-	inode-&gt;i_mapping-&gt;a_ops = &amp;z_erofs_aops;
-	return 0;
-}
-
 struct z_erofs_maprecorder {
 	struct inode *inode;
 	struct erofs_map_blocks *map;
-- 
2.43.0</trace></asm></driz2t@qq.com></hsiangkao@linux.alibaba.com>

             reply	other threads:[~2026-03-25 11:11 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-25 11:11 driz2t [this message]
  -- strict thread matches above, loose matches on Subject: below --
2026-03-25  6:57 [PATCH 6.1.y] erofs: get rid of z_erofs_fill_inode() driz2t
2026-03-25  7:15 ` Gao Xiang
2026-03-24 12:48 driz2t

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=tencent_4CAC91CB31E29B2052C48E4A15D379060905@qq.com \
    --to=driz2t@qq.com \
    --cc=chao@kernel.org \
    --cc=jefflexu@linux.alibaba.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    --cc=syzbot+016d861797fd718491a8@syzkaller.appspotmail.com \
    --cc=xiang@kernel.org \
    /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