]> www.infradead.org Git - users/hch/dma-mapping.git/commit
bcachefs: fsck: Improve hash_check_key()
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 18 Oct 2024 04:22:09 +0000 (00:22 -0400)
committerKent Overstreet <kent.overstreet@linux.dev>
Fri, 18 Oct 2024 04:49:48 +0000 (00:49 -0400)
commitbc6d2d10418e1bfdb95b16f5dd4cca42d5dec766
tree4a98f0299a6443590ad2ff8460898603d786d389
parentdc96656b20eb6f7dea0ccd220541b4af49cf5789
bcachefs: fsck: Improve hash_check_key()

hash_check_key() checks and repairs the hash table btrees: dirents and
xattrs are open addressing hash tables.

We recently had a corruption reported where the hash type on an inode
somehow got flipped, which made the existing dirents invisible and
allowed new ones to be created with the same name.

Now, hash_check_key() can repair duplicates: it will delete one of them,
if it has an xattr or dangling dirent, but if it has two valid dirents
one of them gets renamed.

Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
fs/bcachefs/dirent.c
fs/bcachefs/dirent.h
fs/bcachefs/fsck.c