Skip to content

Commit ec2a834

Browse files
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 <noreply@anthropic.com>
1 parent 4bd0275 commit ec2a834

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

‎homa_rpc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,6 @@ void homa_rpc_get_info(struct homa_rpc *rpc, struct homa_rpc_info *info)
844844
rpc->msgin.bytes_remaining == 0 &&
845845
skb_queue_len(&rpc->msgin.packets) == 0)
846846
info->flags |= HOMA_RPC_RX_READY;
847-
if (rpc->flags & RPC_PRIVATE)
847+
if (test_bit(RPC_PRIVATE, &rpc->flags))
848848
info->flags |= HOMA_RPC_PRIVATE;
849849
}

‎test/unit_homa_rpc.c‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1572,7 +1572,18 @@ TEST_F(homa_rpc, homa_rpc_get_info__HOMA_RPC_PRIVATE)
15721572
self->server_port, self->client_id, 5000, 20000);
15731573
struct homa_rpc_info info;
15741574

1575-
crpc->flags |= RPC_PRIVATE;
1575+
set_bit(RPC_PRIVATE, &crpc->flags);
15761576
homa_rpc_get_info(crpc, &info);
15771577
EXPECT_EQ(HOMA_RPC_PRIVATE, info.flags);
15781578
}
1579+
TEST_F(homa_rpc, homa_rpc_get_info__APP_NEEDS_LOCK_is_not_private)
1580+
{
1581+
struct homa_rpc *crpc = unit_client_rpc(&self->hsk,
1582+
UNIT_OUTGOING, self->client_ip, self->server_ip,
1583+
self->server_port, self->client_id, 5000, 20000);
1584+
struct homa_rpc_info info;
1585+
1586+
set_bit(APP_NEEDS_LOCK, &crpc->flags);
1587+
homa_rpc_get_info(crpc, &info);
1588+
EXPECT_EQ(0, info.flags);
1589+
}

0 commit comments

Comments
 (0)