Support filesystems with invalid inode numbers on individual files
Some checks are pending
Build / build-mac (push) Waiting to run
Build / build-linux (push) Waiting to run
Build / build-win (push) Waiting to run
CodeQL Advanced / Analyze (c-cpp) (push) Waiting to run
CodeQL Advanced / Analyze (actions) (push) Waiting to run

This commit is contained in:
Andrea Mazzoleni 2026-07-30 16:20:26 +02:00
parent 5f724b047b
commit 3a5a3b23ee
8 changed files with 89 additions and 57 deletions

View file

@ -660,7 +660,6 @@ static int file_post(struct snapraid_state* state, int fix, block_off_t i, struc
struct snapraid_file* collide_file;
struct snapraid_file* file;
block_off_t file_pos;
uint64_t inode;
disk = handle[j].disk;
if (!disk) {
@ -774,10 +773,12 @@ static int file_post(struct snapraid_state* state, int fix, block_off_t i, struc
log_tag("status:recovered:%s:%s\n", disk->name, esc_tag(file->sub));
msg_info("recovered %s\n", fmt_term(disk, file->sub));
inode = handle[j].st.st_ino;
/* search for the corresponding inode */
collide_file = tommy_hashdyn_search(&disk->inodeset, file_inode_compare_to_arg, &inode, file_inode_hash(inode));
uint64_t inode = handle[j].st.st_ino; /* don't know the exact type of st_ino and we cannot pass it by pointer in the search */
if (inode != INODE_INVALID)
collide_file = tommy_hashdyn_search(&disk->inodeset, file_inode_compare_to_arg, &inode, file_inode_hash(inode));
else
collide_file = 0;
/*
* If the inode is already in the database and it refers to a different file name,