mirror of
https://github.com/versity/scoutfs.git
synced 2026-07-29 03:23:13 +00:00
560c91a0e46d7d17655145a65c4c6a327582b3de
The search_xattrs ioctl looks for srch entries in srch files that map the caller's hashed xattr name to inodes. As it searches it maintains a range of entries that it is looking for. When it searches sorted srch files for entries it first performs a binary search for the start of the range and then iterates over the blocks until it reaches the end of its range. The binary search for the start of the range was a bit wrong. If the start of the range was less than all the blocks then the binary search could wrap the left index, try to get a file block at a negative index, and return an error for the search. This is relatively hard to hit in practice. You have to search for the xattr name with the smallest hashed value and have a sorted srch file that's just the right size so that blk offset 0 is the last block compared in the binary search, which sets the right index to -1. If there are lots of xattrs, or sorted files of the wrong length, it'll work. This fixes the binary search so that it specifically records the first block offset that intersects with the range and tests that the left and right offsets haven't been inverted. Now that we're not breaking out of the binary search loop we can more obviously put each block reference that we get. Signed-off-by: Zach Brown <zab@versity.com>
Description
No description provided
6.9 MiB
Languages
C
86.4%
Shell
9.9%
Roff
2.5%
TeX
0.8%
Makefile
0.4%