]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
client: only wait for write MDS OPs when unmounting 52303/head
authorXiubo Li <xiubli@redhat.com>
Thu, 4 May 2023 06:22:37 +0000 (14:22 +0800)
committerXiubo Li <xiubli@redhat.com>
Tue, 4 Jul 2023 01:47:25 +0000 (09:47 +0800)
We do not care about the read MDS OPs and it's safe by just dropping
them when unmounting.

Fixes: https://tracker.ceph.com/issues/59705
Signed-off-by: Xiubo Li <xiubli@redhat.com>
(cherry picked from commit ee8443d63a175b9e5a3c60ba4e06270ae688d910)

src/client/Client.cc

index bdee3b3176ff2cd4c08e8ccaab679985e6e74fbd..ce65477ea555cc19e428c8c6bcc71ea3c2dc766f 100644 (file)
@@ -6555,11 +6555,18 @@ void Client::_unmount(bool abort)
   }
 
   mount_cond.wait(lock, [this] {
-    if (!mds_requests.empty()) {
-      ldout(cct, 10) << "waiting on " << mds_requests.size() << " requests"
-                    << dendl;
+    // Only wait for write OPs
+    for (auto& [tid, req] : mds_requests) {
+      if (req->is_write()) {
+        ldout(cct, 10) << "waiting for write request '" << tid
+                       << "' to complete, currently there are "
+                       << mds_requests.size()
+                       << " outstanding read/write requests"
+                       << dendl;
+        return false;
+      }
     }
-    return mds_requests.empty();
+    return true;
   });
 
   cwd.reset();
@@ -6572,7 +6579,7 @@ void Client::_unmount(bool abort)
     ldout(cct, 0) << " destroyed lost open file " << fh << " on " << *fh->inode << dendl;
     _release_fh(fh);
   }
-  
+
   while (!ll_unclosed_fh_set.empty()) {
     set<Fh*>::iterator it = ll_unclosed_fh_set.begin();
     Fh *fh = *it;