Project

General

Profile

Bug #57359

mds/Server: -ve values cause unexpected client eviction while handling client reclaim

Added by Dhairya Parmar over 1 year ago. Updated 11 months ago.

Status:
Resolved
Priority:
High
Category:
Correctness/Safety
Target version:
-
% Done:

0%

Source:
Development
Tags:
backport_processed
Backport:
pacific,quincy
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(FS):
MDS
Labels (FS):
task(easy)
Pull request ID:
Crash signature (v1):
Crash signature (v2):

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.


Related issues

Copied to CephFS - Backport #58600: quincy: mds/Server: -ve values cause unexpected client eviction while handling client reclaim Resolved
Copied to CephFS - Backport #58601: pacific: mds/Server: -ve values cause unexpected client eviction while handling client reclaim Resolved

History

#1 Updated by Dhairya Parmar over 1 year ago

  • Assignee set to Dhairya Parmar

#2 Updated by Dhairya Parmar over 1 year ago

  • Status changed from New to Fix Under Review
  • Pull request ID set to 48251

#3 Updated by Dhairya Parmar over 1 year ago

  • Backport set to pacific,quincy

#4 Updated by Rishabh Dave about 1 year ago

  • Status changed from Fix Under Review to Pending Backport

#5 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

#6 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

#7 Updated by Backport Bot about 1 year ago

  • Tags set to backport_processed

#8 Updated by Dhairya Parmar 11 months ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF