From 86ede4e35fe9924df08138723b53ebcd10089a81 Mon Sep 17 00:00:00 2001 From: Venky Shankar Date: Tue, 18 Mar 2025 08:57:18 +0000 Subject: [PATCH] Revert "mds: Fix straydn race between unlink/rename linkmerge" This reverts commit f264f11f44d6355452dadc2a20efddc012c531e3. Signed-off-by: Venky Shankar (cherry picked from commit 2d0a9e45065836ba52970e8663567d2673bc816a) --- src/mds/Mutation.h | 3 --- src/mds/Server.cc | 25 ------------------------- 2 files changed, 28 deletions(-) diff --git a/src/mds/Mutation.h b/src/mds/Mutation.h index dd80d1e26f9..1abdd77af9c 100644 --- a/src/mds/Mutation.h +++ b/src/mds/Mutation.h @@ -485,9 +485,6 @@ struct MDRequestImpl : public MutationImpl { // indicator for vxattr osdmap update bool waited_for_osdmap = false; - // referent straydn - bool referent_straydn = false; - protected: void _dump(ceph::Formatter *f) const override { _dump(f, false); diff --git a/src/mds/Server.cc b/src/mds/Server.cc index 261ae715be9..a81d6d09639 100644 --- a/src/mds/Server.cc +++ b/src/mds/Server.cc @@ -8527,37 +8527,14 @@ void Server::handle_client_unlink(const MDRequestRef& mdr) // -- create stray dentry? -- CDentry *straydn = NULL; if (dnl->is_primary()) { - /* Handle race between unlink of secondary hardlink (say hl_file1) and - * linkmerge rename, triggered by unlink of primary (say file1) on to - * the same secondary hardlink (hl_file1). - * 1. unlink hl_file1 - * 2. prepares straydn for referent inode - * 3. wait for the locks - * - * unlink file1, triggers linkmerge rename - * rename(hl_file1, primary_stray) ---> referent straydn converted to primary - * - * 4. On retry, it find itself as primary, - * needs to prepare straydn for primary. - * so clean up the earlier referent straydn - */ - if (mdr->straydn && mdr->referent_straydn) { - dout(10) << __func__ << " race, clean up referent straydn " << *mdr->straydn << dendl; - mdr->unpin(mdr->straydn); - mdr->straydn = nullptr; - } straydn = prepare_stray_dentry(mdr, dnl->get_inode()); if (!straydn) return; - mdr->referent_straydn = false; dout(10) << " straydn is " << *straydn << dendl; } else if (dnl->is_referent_remote()) { - // Above race is not applicable here since a referent can get converted - // to primary but not the otherway. straydn = prepare_stray_dentry(mdr, dnl->get_referent_inode()); if (!straydn) return; - mdr->referent_straydn = true; dout(10) << __func__ << " referent straydn is " << *straydn << dendl; } else if (mdr->straydn) { mdr->unpin(mdr->straydn); @@ -9420,13 +9397,11 @@ void Server::handle_client_rename(const MDRequestRef& mdr) straydn = prepare_stray_dentry(mdr, destdnl->get_inode()); if (!straydn) return; - mdr->referent_straydn = false; dout(10) << " straydn is " << *straydn << dendl; } else if (destdnl->is_referent_remote()) { //both linkmerge and non linkmerge case straydn = prepare_stray_dentry(mdr, destdnl->get_referent_inode()); if (!straydn) return; - mdr->referent_straydn = true; dout(10) << __func__ << (linkmerge ? " linkmerge:yes ": " linkmerge:no ") << " referent straydn is " << *straydn << dendl; } else if (mdr->straydn) { -- 2.39.5