2
2
mirror of https://github.com/octoleo/restic.git synced 2024-05-29 07:00:49 +00:00
restic/internal/fuse
greatroar a0885d5d69 fuse: Mix inode hashes in a non-symmetric way
Since 0.15 (#4020), inodes are generated as hashes of names, xor'd with
the parent inode. That means that the inode of a/b/b is

	h(a/b/b) = h(a) ^ h(b) ^ h(b) = h(a).

I.e., the grandchild has the same inode as the grandparent. GNU find
trips over this because it thinks it has encountered a loop in the
filesystem, and fails to search a/b/b. This happens more generally when
the same name occurs an even number of times.

Fix this by multiplying the parent by a large prime, so the combining
operation is not longer symmetric in its arguments. This is what the FNV
hash does, which we used prior to 0.15. The hash is now

	h(a/b/b) = h(b) ^ p*(h(b) ^ p*h(a))

Note that we already ensure that h(x) is never zero.

Collisions can still occur, but they should be much less likely to occur
within a single path.

Fixes #4253.
2023-03-21 17:33:18 +01:00
..
dir.go Merge pull request #4020 from greatroar/fuse-inode 2022-12-02 22:28:15 +01:00
file.go mount: switch to anacrolix fork of bazil/fuse 2022-11-12 19:22:31 +01:00
fuse_test.go fuse: Mix inode hashes in a non-symmetric way 2023-03-21 17:33:18 +01:00
inode.go fuse: Mix inode hashes in a non-symmetric way 2023-03-21 17:33:18 +01:00
link.go mount: switch to anacrolix fork of bazil/fuse 2022-11-12 19:22:31 +01:00
other.go mount: switch to anacrolix fork of bazil/fuse 2022-11-12 19:22:31 +01:00
root.go cmd, restic: Refactor and fix snapshot filtering 2023-02-19 15:04:25 +01:00
snapshots_dir.go Merge pull request #4020 from greatroar/fuse-inode 2022-12-02 22:28:15 +01:00
snapshots_dirstruct_test.go mount: Map slashes in tags to underscores 2022-08-19 18:17:57 +02:00
snapshots_dirstruct.go cmd, restic: Refactor and fix snapshot filtering 2023-02-19 15:04:25 +01:00