From 3584ecc876b981b2204fbd7f720867e454639c58 Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Tue, 5 Jul 2022 12:59:11 +0800 Subject: [PATCH] client: switch to use 32 bits ext_num_fwd The MDS will increase the forward count, and if the forward count is less than the one saved in request in client side, that means the MDS is old version and it was overflowed. Then just stop forwarding. Fixes: https://tracker.ceph.com/issues/57854 Signed-off-by: Xiubo Li --- src/client/Client.cc | 36 ++++++++++++------------------------ 1 file changed, 12 insertions(+), 24 deletions(-) diff --git a/src/client/Client.cc b/src/client/Client.cc index 9a182ddf10ae9..dd06dfcad2d90 100644 --- a/src/client/Client.cc +++ b/src/client/Client.cc @@ -2578,7 +2578,7 @@ ref_t Client::build_client_request(MetaRequest *request, mds_ran req->fscrypt_auth = request->fscrypt_auth; req->fscrypt_file = request->fscrypt_file; req->set_retry_attempt(request->retry_attempt++); - req->head.num_fwd = request->num_fwd; + req->head.ext_num_fwd = request->num_fwd; const gid_t *_gids; int gid_count = request->perms.get_gids(&_gids); req->set_gid_list(gid_count, _gids); @@ -2607,32 +2607,20 @@ void Client::handle_client_request_forward(const MConstRefnum_fwd); - max_fwd = (1 << (max_fwd * CHAR_BIT)) - 1; auto num_fwd = fwd->get_num_fwd(); - if (num_fwd <= request->num_fwd || num_fwd >= max_fwd) { - if (request->num_fwd >= max_fwd || num_fwd >= max_fwd) { - request->abort(-CEPHFS_EMULTIHOP); - request->caller_cond->notify_all(); - ldout(cct, 1) << __func__ << " tid " << tid << " seq overflow" - << ", abort it" << dendl; - } else { - ldout(cct, 10) << __func__ << " tid " << tid - << " old fwd seq " << fwd->get_num_fwd() - << " <= req fwd " << request->num_fwd - << ", ignore it" << dendl; - } + if (num_fwd <= request->num_fwd || (uint32_t)num_fwd >= UINT32_MAX) { + request->abort(-CEPHFS_EMULTIHOP); + request->caller_cond->notify_all(); + ldout(cct, 0) << __func__ << " request tid " << tid << " new num_fwd " + << num_fwd << " old num_fwd " << request->num_fwd << ", fwd seq overflow" + << ", abort it" << dendl; return; } -- 2.39.5