Skip to contentSkip to conversation

erofs-utils: mkfs: fix raw tail padding after compression fallback

PATCH New Gao Xiang 1 participant 1 message Nov 19 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: mkfs: fix raw tail padding after compression fallback

With -Eztailpacking, compression can prepare a compressed inline tail before falling back to uncompressed storage due to insufficient space savings. However, idata_type is not reset when the raw tail is read.

If the raw tail cannot be inlined, erofs_write_tail_end() treats it as compressed data and adds head padding, corrupting the file contents.

Set idata_type to EROFS_IDATA_TYPE_RAW when writing unencoded data.

Assisted-by ChatGPT:gpt-6.1-sol
Fixes ddea76ad592f ("erofs-utils: mkfs: support tail-packing inline compressed data")
---
 lib/inode.c | 1 +
 1 file changed, 1 insertion(+)
lib/inode.c +1 -0
index f687857..7a26a18 100644
@@ -651,6 +651,7 @@ static int erofs_write_unencoded_data(struct erofs_inode *inode,
 			return -EIO;
 	}
 
+	inode->idata_type = EROFS_IDATA_TYPE_RAW;
 	inode->idata_size = inode->i_size % erofs_blksiz(sbi);
 	remaining = inode->i_size - inode->idata_size;
 
Signature · 1 line
2.54.0 (Apple Git-157)