Skip to contentSkip to conversation

erofs-utils: rebuild: only update dev/i_ino[1] pairs for directories

PATCH New Gao Xiang 1 participant 1 message Jul 2, 2024 Library code

lore
Share & tools
lore

Gao Xiang

author
#0 lore raw

PATCH 1/1 erofs-utils: rebuild: only update dev/i_ino[1] pairs for directories

Since the underlying dev/i_ino[1] pairs are only useful for merged sub-directories, don't bother with other types of inodes.

Otherwise, the original i_ino[1] could be overwritten unexpectedly, which impacts resvsp mode at least..

Fixes f64d9d02576b ("erofs-utils: introduce incremental builds")
---
 lib/rebuild.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
lib/rebuild.c +7 -4
index 8b186eb..0b1a6c6 100644
@@ -464,10 +464,13 @@ static int erofs_rebuild_basedir_dirent_iter(struct erofs_dir_context *ctx)
 	} else {
 		struct erofs_inode *inode = d->inode;
 
-		list_del(&inode->i_hash);
-		inode->dev = dir->sbi->dev;
-		inode->i_ino[1] = ctx->de_nid;
-		erofs_insert_ihash(inode);
+		/* update sub-directories only for recursively loading */
+		if (S_ISDIR(inode->i_mode)) {
+			list_del(&inode->i_hash);
+			inode->dev = dir->sbi->dev;
+			inode->i_ino[1] = ctx->de_nid;
+			erofs_insert_ihash(inode);
+		}
 	}
 	ret = 0;
 out:
Signature · 1 line
2.43.5