erofs-utils: lib: fix dev_read for large files
When using `fsck.erofs` to extract some image have a very large file
inside, for example 2G, my fsck.erofs report some thing like this:
<E> erofs_io: Failed to read data from device - erofs.image:[4096,
2147483648].
<E> erofs: failed to read data of m_pa 4096, m_plen 2147483648 @ nid 40: -17
<E> erofs: Failed to extract filesystem
You can use this script to reproduce this issue.
mkdir tmp extract
dd if=/dev/urandom of=tmp/big_file bs=1M count=2048
mkfs.erofs erofs.image tmp
fsck.erofs erofs.image --extract=extract
I found that dev_open will failed if we can not get all data we want
with one pread call.
I write this little patch try to fix this issue.
Signed-off-by: Chen Linxuan <chenlinxuan@uniontech.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Link: https://lore.kernel.org/r/20221021064332.357316-1-chenlinxuan@uniontech.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
1 file changed