Skip to contentSkip to conversation

erofs-utils: zmap: fix small compressed files inlining

PATCH Applied Yue Hu 2 participants 2 messages Jul 11, 2023 Library code

lore
Share & tools
lore

Yue Hu

author
#0 lore raw

PATCH 1/1 erofs-utils: zmap: fix small compressed files inlining

From: Yue Hu <[email protected]>

Keep in sync with kernel commit 24331050a3e6 ("erofs: fix small compressed files inlining") to avoid corruption due to m_llen > m_plen for uncompressed pclusters.

Fixes 41790d24329d ("erofs-utils: validate the extent length for uncompressed pclusters")
---
 lib/zmap.c | 7 +++++++
 1 file changed, 7 insertions(+)
lib/zmap.c +7 -0
index 7492e5d..209b5d7 100644
@@ -597,6 +597,13 @@ static int z_erofs_do_map_blocks(struct erofs_inode *vi,
 		if (endoff >= m.clusterofs) {
 			m.headtype = m.type;
 			map->m_la = (m.lcn << lclusterbits) | m.clusterofs;
+			/*
+			 * For ztailpacking files, in order to inline data more
+			 * effectively, special EOF lclusters are now supported
+			 * which can have three parts at most.
+			 */
+			if (ztailpacking && end > vi->i_size)
+				end = vi->i_size;
 			break;
 		}
 		/* m.lcn should be >= 1 if endoff < m.clusterofs */
Signature · 1 line
2.17.1
Applied
#1 lore raw
Quoted 8 lines · Yue Hu

From: Yue Hu <[email protected]>

Keep in sync with kernel commit 24331050a3e6 ("erofs: fix small compressed files inlining") to avoid corruption due to m_llen > m_plen for uncompressed pclusters.

Fixes 41790d24329d ("erofs-utils: validate the extent length for uncompressed pclusters")

Thanks, applied.

Thanks,
Gao Xiang