Bug #57359
closedmds/Server: -ve values cause unexpected client eviction while handling client reclaim
0%
Description
I found this issue while writing tests for PR-47080 where sending negative value for reclaim flag caused tests to freeze, reason being client eviction with no further handling of this condition and the whole thing is stuck forever.
Server::handle_client_reclaim uses get_flags() whose return type is uint32_t, so if a negative value(int) is provided for reclaim flag, it gets converted to a positive value(unsigned int)and this leads to incorrect evaluation of reclaim flag at https://github.com/ceph/ceph/blob/main/src/mds/Server.cc#L530. So, in case of -1 being sent as reclaim flag, 4294967295(typecased to unsigned int) would be the value evaluated with MClientReclaim::FLAG_FINISH and thus wrongly calls Server::finish_reclaim_session instead of Server::reclaim_session, which leads to client eviction at https://github.com/ceph/ceph/blob/main/src/mds/Server.cc#L499-L501 and the whole process is stuck.
One might ask that there should be something that checks for this, yeah it's there(in Server::reclaim_session) but unfortunately NOT in Server::finish_reclaim_session where the wrongly converted value lands to evict the client.
Simple solution can be to look after this edge case in Server::handle_client_reclaim itself by unmasking the value, something like if(reclaim_flag & ~MClientReclaim::FLAG_FINISH) {send message to client this op is not allowed and return}. This is just one of the ways I thought of, there could be better ways to do it so every possible suggestion is highly appreciated.
Updated by Dhairya Parmar over 1 year ago
- Status changed from New to Fix Under Review
- Pull request ID set to 48251
Updated by Rishabh Dave about 1 year ago
- Status changed from Fix Under Review to Pending Backport
Updated by Backport Bot about 1 year ago
- Copied to Backport #58600: quincy: mds/Server: -ve values cause unexpected client eviction while handling client reclaim added
Updated by Backport Bot about 1 year ago
- Copied to Backport #58601: pacific: mds/Server: -ve values cause unexpected client eviction while handling client reclaim added
Updated by Dhairya Parmar about 1 year ago
- Status changed from Pending Backport to Resolved