From 47243aef1429dd2b3eab253f9cf99559a1108f35 Mon Sep 17 00:00:00 2001 From: Zygo Blaxell Date: Mon, 17 Feb 2025 21:12:29 -0500 Subject: [PATCH] hash: handle $BEESHOME on btrfs too The `_nothrow` variants of `do_ioctl` return true when they succeed, which is the opposite of what `ioctl` does. Fix the logic so bees can correctly identify its own hash table when it's on the same filesystem as the target. Fixes: f6908420adcf3fbafef8bbde8a25f8bac65424b6 ("hash: handle $BEESHOME on non-btrfs") Signed-off-by: Zygo Blaxell --- src/bees-hash.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bees-hash.cc b/src/bees-hash.cc index 88e184a..7581fe1 100644 --- a/src/bees-hash.cc +++ b/src/bees-hash.cc @@ -819,7 +819,8 @@ BeesHashTable::BeesHashTable(shared_ptr ctx, string filename, off_t root_info.do_ioctl(m_ctx->root_fd()); // Hash might not be a btrfs BtrfsIoctlFsInfoArgs hash_info; - if (hash_info.do_ioctl_nothrow(m_fd)) return; + // If btrfs fs_info ioctl fails, it must be a different fs + if (!hash_info.do_ioctl_nothrow(m_fd)) return; // If Hash is a btrfs, Root must be the same one if (root_info.fsid() != hash_info.fsid()) return; // Hash is on the same one, blacklist it