On 1/28/24 04:44, Qu Wenruo wrote:
[BUG] There is a report about reading a zstd compressed inline file extent would lead to either a VM_BUG_ON() crash, or lead to incorrect file content. [CAUSE] The root cause is a incorrect memcpy_to_page() call, which uses incorrect page offset, and can lead to either the VM_BUG_ON() as we may write beyond the page boundary, or writes into the incorrect offset of the page. [TEST CASE] The test case would: - Mount with the specified compress algorithm - Create a 4K file - Verify the 4K file is all inlined and compressed - Verify the content of the initial write - Cycle mount to drop all the page cache - Verify the content of the file again - Unmount and fsck the fs This workload would be applied to all supported compression algorithms. And it can catch the problem correctly by triggering VM_BUG_ON(), as our workload would result decompressed extent size to be 4K, and would trigger the VM_BUG_ON() 100%. And with the revert or the new fix, the test case can pass safely. Signed-off-by: Qu Wenruo <wqu@xxxxxxxx>
Reviewed-by: Anand Jain <anand.jain@xxxxxxxxxx>