]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Revert "mds: clear the STATE_UNLINKING state when the unlink fails"
authorXiubo Li <xiubli@redhat.com>
Tue, 12 Sep 2023 02:24:59 +0000 (10:24 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 12 Sep 2023 03:10:18 +0000 (11:10 +0800)
This reverts commit 417f24782cfcf45827dff74adf8df2283b2a2c72.

Fixes: https://tracker.ceph.com/issues/61818
Signed-off-by: Xiubo Li <xiubli@redhat.com>
src/mds/Server.cc

index c2e54dcd1f345ed6e4d830ba3b5edbef40dee323..752756483780a406452daaf36c8cf9a8dbe69801 100644 (file)
@@ -6880,7 +6880,6 @@ bool Server::is_unlink_pending(CDentry *dn)
 
 void Server::wait_for_pending_unlink(CDentry *dn, MDRequestRef& mdr)
 {
-  dout(20) << __func__ << " dn " << *dn << dendl;
   mds->locker->drop_locks(mdr.get());
   auto fin = new C_MDS_RetryRequest(mdcache, mdr);
   dn->get(CDentry::PIN_PURGING);
@@ -7966,13 +7965,11 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
     if (rmdir) {
       // do empty directory checks
       if (_dir_is_nonempty_unlocked(mdr, in)) {
-        dn->state_clear(CDentry::STATE_UNLINKING);
-        respond_to_request(mdr, -CEPHFS_ENOTEMPTY);
+       respond_to_request(mdr, -CEPHFS_ENOTEMPTY);
        return;
       }
     } else {
       dout(7) << "handle_client_unlink on dir " << *in << ", returning error" << dendl;
-      dn->state_clear(CDentry::STATE_UNLINKING);
       respond_to_request(mdr, -CEPHFS_EISDIR);
       return;
     }
@@ -7980,7 +7977,6 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
     if (rmdir) {
       // unlink
       dout(7) << "handle_client_rmdir on non-dir " << *in << ", returning error" << dendl;
-      dn->state_clear(CDentry::STATE_UNLINKING);
       respond_to_request(mdr, -CEPHFS_ENOTDIR);
       return;
     }
@@ -7988,10 +7984,8 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
 
   CInode *diri = dn->get_dir()->get_inode();
   if ((!mdr->has_more() || mdr->more()->witnessed.empty())) {
-    if (!check_access(mdr, diri, MAY_WRITE)) {
-      dn->state_clear(CDentry::STATE_UNLINKING);
+    if (!check_access(mdr, diri, MAY_WRITE))
       return;
-    }
   }
 
   // -- create stray dentry? --
@@ -8030,7 +8024,6 @@ void Server::handle_client_unlink(MDRequestRef& mdr)
   if (in->is_dir() &&
       _dir_is_nonempty(mdr, in)) {
     respond_to_request(mdr, -CEPHFS_ENOTEMPTY);
-    dn->state_clear(CDentry::STATE_UNLINKING);
     return;
   }