]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commit
mds/Server: do not allow -ve reclaim flags to cause client eviction 49956/head
authordparmar18 <dparmar@redhat.com>
Mon, 26 Sep 2022 11:18:23 +0000 (16:48 +0530)
committerdparmar18 <dparmar@redhat.com>
Wed, 1 Feb 2023 09:58:34 +0000 (15:28 +0530)
commit3bbbe0d2947ef13819d44f67b3650a2bca1f8799
tree54ff81818cf9477f22a47e729fc655c58e97e394
parent0053576efd2db0101388bd43dd857fc2ff51e10a
mds/Server: do not allow -ve reclaim flags to cause client eviction

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.

So, for instance if -1 is 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 unexepected client eviction.

This can fixed if we check the signed value of flag before calling out anything
by typecasting the value of m->get_flags() to int32_t.
(reason typecasting to int32_t is get_flags() returning value of type uint32_t).

Fixes: https://tracker.ceph.com/issues/57359
Signed-off-by: Dhairya Parmar <dparmar@redhat.com>
(cherry picked from commit c0390f528e0b80ee494c3916e4d1ca6cad6f3c77)
src/mds/Server.cc
src/test/client/ops.cc