From 76e442f147edab24a4cc3729a9470be169635efc Mon Sep 17 00:00:00 2001 From: Xiubo Li Date: Wed, 30 Aug 2023 13:24:01 +0800 Subject: [PATCH] mds: continue linking if targeti is temporarily located in stray dir If one inode has more than one hardlink and after the primary dentry is unlinked it will located the inode in the stray dir temporarily, which is pending reintegration. Just before the linkmerge/migrate is triggered a link request comes it will fail with -EXDEV. Just skip it and continue the linking. Fixes: https://tracker.ceph.com/issues/56695 Signed-off-by: Xiubo Li (cherry picked from commit 5b9df823a2ab333be6205b8add8fbae7c3d2cc17) --- src/mds/Server.cc | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index d585b39380514..48e42584f88ab 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -7195,7 +7195,9 @@ void Server::handle_client_link(MDRequestRef& mdr) SnapRealm *target_realm = target_pin->find_snaprealm(); if (target_pin != dir->inode && target_realm->get_subvolume_ino() != - dir->inode->find_snaprealm()->get_subvolume_ino()) { + dir->inode->find_snaprealm()->get_subvolume_ino() && + /* The inode is temporarily located in the stray dir pending reintegration */ + !target_pin->is_stray()) { dout(7) << "target is in different subvolume, failing..." << dendl; respond_to_request(mdr, -CEPHFS_EXDEV); return; -- 2.39.5