]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mds: Fix straydn race between unlink/rename linkmerge"
authorVenky Shankar <vshankar@redhat.com>
Tue, 18 Mar 2025 08:57:18 +0000 (08:57 +0000)
committerVenky Shankar <vshankar@redhat.com>
Fri, 20 Mar 2026 07:25:14 +0000 (12:55 +0530)
This reverts commit f264f11f44d6355452dadc2a20efddc012c531e3.

Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/mds/Mutation.h
src/mds/Server.cc

index de915a55f6edd21456a6e42f442902b9fa327f3f..aa71ffde795dafaed25b5939c204521ca3d078ab 100644 (file)
@@ -490,9 +490,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);
index e95ba74a54e44bb9113b1fc3a9b7336ebcd253c6..51b7d862e77e2007962c37d15db07d986b7b4557 100644 (file)
@@ -8684,37 +8684,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);
@@ -9579,13 +9556,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) {