mirror of
https://github.com/torvalds/linux.git
synced 2024-11-14 16:12:02 +00:00
f2fs: compress: fix zstd data corruption
During zstd compression, ZSTD_endStream() may return non-zero value
because distination buffer is full, but there is still compressed data
remained in intermediate buffer, it means that zstd algorithm can not
save at last one block space, let's just writeback raw data instead of
compressed one, this can fix data corruption when decompressing
incomplete stored compression data.
Fixes: 50cfa66f0d
("f2fs: compress: support zstd compress algorithm")
Signed-off-by: Daeho Jeong <daehojeong@google.com>
Signed-off-by: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
9c1223845a
commit
1454c978ef
@ -360,6 +360,13 @@ static int zstd_compress_pages(struct compress_ctx *cc)
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
/*
|
||||
* there is compressed data remained in intermediate buffer due to
|
||||
* no more space in cbuf.cdata
|
||||
*/
|
||||
if (ret)
|
||||
return -EAGAIN;
|
||||
|
||||
cc->clen = outbuf.pos;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user