erofs-utils: fix the current rebuild mode
PATCH 1/1 erofs-utils: fix the current rebuild mode
inode->with_diskbuf can be false in the rebuild mode since inode data has been mapped before.
Fixes 203c847cc7d1 ("erofs-utils: unify the tree traversal for the rebuild mode")
Signed-off-by Gao Xiang <[email protected]>
--- lib/inode.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/inode.c +5 -4
@@ -1148,7 +1148,7 @@ static int erofs_mkfs_handle_nondirectory(struct erofs_mkfs_job_ndir_ctx *ctx) ret =erofs_write_file_from_buffer (inode, symlink);free (symlink); inode->i_link =NULL ; - }else if (inode->i_size) { + }else if (inode->i_size && ctx->fd >=0 ) { ret =erofs_mkfs_job_write_file (ctx); }if (ret)
@@ -1484,10 +1484,11 @@ static int erofs_rebuild_handle_inode(struct erofs_inode *inode)return ret;if (!S_ISDIR (inode->i_mode)) { -struct erofs_mkfs_job_ndir_ctx ctx = { .inode = inode }; +struct erofs_mkfs_job_ndir_ctx ctx = + { .inode = inode, .fd =-1 }; -if (!S_ISLNK (inode->i_mode) && inode->i_size) { -DBG_BUGON (!inode->with_diskbuf); +if (!S_ISLNK (inode->i_mode) && inode->i_size && + inode->with_diskbuf) { ctx.fd =erofs_diskbuf_getfd (inode->i_diskbuf, &ctx.fpos);if (ctx.fd <0 )return ret;
Signature · 1 line
2.39.3