From ec2a834a39eaf254fc88f0799f15e9debd06e1db Mon Sep 17 00:00:00 2001 From: "randomizedcoder dave.seddon.ca@gmail.com" Date: Wed, 28 Oct 2026 18:56:04 -0700 Subject: [PATCH] Use test_bit for RPC_PRIVATE in homa_rpc_get_info * RPC_PRIVATE is a bit number (2), set with set_bit, but homa_rpc_get_info tested it as a mask, which checks bit 1 (APP_NEEDS_LOCK). HOMAIOCINFO therefore never reported HOMA_RPC_PRIVATE for private RPCs, and reported it for RPCs whose lock was being requested by the application. * The existing test set the flag with |=, which hid the bug; use set_bit and add a test that APP_NEEDS_LOCK alone isn't reported. Co-Authored-By: Claude Opus 5.5 --- homa_rpc.c | 2 +- test/unit_homa_rpc.c | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/homa_rpc.c b/homa_rpc.c index 7804577e..91f013ce 100644 --- a/homa_rpc.c +++ b/homa_rpc.c @@ -844,6 +844,6 @@ void homa_rpc_get_info(struct homa_rpc *rpc, struct homa_rpc_info *info) rpc->msgin.bytes_remaining == 0 && skb_queue_len(&rpc->msgin.packets) == 0) info->flags |= HOMA_RPC_RX_READY; - if (rpc->flags & RPC_PRIVATE) + if (test_bit(RPC_PRIVATE, &rpc->flags)) info->flags |= HOMA_RPC_PRIVATE; } diff --git a/test/unit_homa_rpc.c b/test/unit_homa_rpc.c index 06d55123..534600c5 100644 --- a/test/unit_homa_rpc.c +++ b/test/unit_homa_rpc.c @@ -1572,7 +1572,18 @@ TEST_F(homa_rpc, homa_rpc_get_info__HOMA_RPC_PRIVATE) self->server_port, self->client_id, 5000, 20000); struct homa_rpc_info info; - crpc->flags |= RPC_PRIVATE; + set_bit(RPC_PRIVATE, &crpc->flags); homa_rpc_get_info(crpc, &info); EXPECT_EQ(HOMA_RPC_PRIVATE, info.flags); } +TEST_F(homa_rpc, homa_rpc_get_info__APP_NEEDS_LOCK_is_not_private) +{ + struct homa_rpc *crpc = unit_client_rpc(&self->hsk, + UNIT_OUTGOING, self->client_ip, self->server_ip, + self->server_port, self->client_id, 5000, 20000); + struct homa_rpc_info info; + + set_bit(APP_NEEDS_LOCK, &crpc->flags); + homa_rpc_get_info(crpc, &info); + EXPECT_EQ(0, info.flags); +}