From 85279ac657832fd643ee2cc5f1f6a27f98e099f6 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Tue, 6 Jun 2023 13:09:00 +0530 Subject: [PATCH] mds: Fix the linkmerge assert check Let's say there is a hardlink created as below. touch file1 ln file1 hl_file1 In this case 'file1' holds the primary inode and 'hl_file' holds the remote inode (holds primary inode number and other required info). Now, if the 'file1' is deleted first, it's moved to a stray directory and can't be deleted because the hardlink 'hl_file1' still exists which requires primary inode. So on straydn eval, this primary inode is linked to 'hl_file1 and remote inode is removed. This is called the linkmerge/stray reintegration. So in the linkmerge case, the srcdnl is primary straydn and the destdnl is the remote. Signed-off-by: Kotresh HR Fixes: https://tracker.ceph.com/issues/61879 --- src/mds/Server.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 72ddcf6196cbb..3f4ededfd8cec 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -9741,7 +9741,7 @@ void Server::_rename_apply(MDRequestRef& mdr, CDentry *srcdn, CDentry *destdn, C // primary+remote link merge? bool linkmerge = (srcdnl->get_inode() == oldin); if (linkmerge) - ceph_assert(srcdnl->is_primary() || destdnl->is_remote()); + ceph_assert(srcdnl->is_primary() && destdnl->is_remote()); bool new_in_snaprealm = false; bool new_oldin_snaprealm = false;