Currently fsck skips file extraction if it finds that EROFS_MAP_MAPPED
is unset, which is not the case for chunk-based files with holes.
This patch handles the corner case correctly.
Signed-off-by: Yifan Zhao <zhaoyifan@sjtu.edu.cn>
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
pos += map.m_llen;
/* should skip decomp? */
- if (!(map.m_flags & EROFS_MAP_MAPPED) || !fsckcfg.check_decomp)
+ if (map.m_la >= inode->i_size || !fsckcfg.check_decomp)
continue;
+ if (outfd >= 0 && !(map.m_flags & EROFS_MAP_MAPPED)) {
+ ret = lseek(outfd, map.m_llen, SEEK_CUR);
+ if (ret < 0) {
+ ret = -errno;
+ goto out;
+ }
+ continue;
+ }
+
if (map.m_plen > Z_EROFS_PCLUSTER_MAX_SIZE) {
if (compressed) {
erofs_err("invalid pcluster size %" PRIu64 " @ offset %" PRIu64 " of nid %" PRIu64,