]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: track complete async operation return code
authorMykola Golub <mgolub@suse.com>
Mon, 21 Sep 2020 13:32:17 +0000 (14:32 +0100)
committerMykola Golub <mgolub@suse.com>
Mon, 14 Feb 2022 12:35:41 +0000 (14:35 +0200)
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 96bc20445afb0b2579a79b54a7854bc4a23f5b62)

Conflicts:
src/librbd/ImageWatcher.cc (no quiesce requests in octopus)

src/librbd/ImageWatcher.cc
src/librbd/ImageWatcher.h

index 4b067025b9d16a79416d14a34ba875f4028ff023..02a52a65fa464278f058f9819c76d094105448f1 100644 (file)
@@ -166,7 +166,7 @@ void ImageWatcher<I>::handle_async_complete(const AsyncRequestId &request,
   }
 
   std::unique_lock async_request_locker{m_async_request_lock};
-  mark_async_request_complete(request);
+  mark_async_request_complete(request, r);
   m_async_op_tracker.finish_op();
 }
 
@@ -497,7 +497,8 @@ bool ImageWatcher<I>::is_new_request(const AsyncRequestId &id) const {
 }
 
 template <typename I>
-bool ImageWatcher<I>::mark_async_request_complete(const AsyncRequestId &id) {
+bool ImageWatcher<I>::mark_async_request_complete(const AsyncRequestId &id,
+                                                  int r) {
   ceph_assert(ceph_mutex_is_locked(m_async_request_lock));
 
   bool found = m_async_pending.erase(id);
@@ -510,7 +511,7 @@ bool ImageWatcher<I>::mark_async_request_complete(const AsyncRequestId &id) {
     it = m_async_complete_expiration.erase(it);
   }
 
-  if (m_async_complete.insert(id).second) {
+  if (m_async_complete.insert({id, r}).second) {
     auto expiration_time = now;
     expiration_time += 600;
     m_async_complete_expiration.insert({expiration_time, id});
@@ -607,6 +608,10 @@ int ImageWatcher<I>::prepare_async_request(const AsyncRequestId& async_request_i
       *ctx = new RemoteContext(*this, async_request_id, *prog_ctx);
     } else {
       *new_request = false;
+      auto it = m_async_complete.find(async_request_id);
+      if (it != m_async_complete.end()) {
+        return it->second;
+      }
     }
   }
   return 0;
index b71e83dc972c0cf3f641c88ddcff03415e581de7..52b2bc18cae6c09e166e9abd42a0e64bb1518c10 100644 (file)
@@ -168,7 +168,7 @@ private:
   ceph::shared_mutex m_async_request_lock;
   std::map<watch_notify::AsyncRequestId, AsyncRequest> m_async_requests;
   std::set<watch_notify::AsyncRequestId> m_async_pending;
-  std::set<watch_notify::AsyncRequestId> m_async_complete;
+  std::map<watch_notify::AsyncRequestId, int> m_async_complete;
   std::set<std::pair<utime_t,
                      watch_notify::AsyncRequestId>> m_async_complete_expiration;
 
@@ -192,7 +192,8 @@ private:
                          Context *on_finish);
 
   bool is_new_request(const watch_notify::AsyncRequestId &id) const;
-  bool mark_async_request_complete(const watch_notify::AsyncRequestId &id);
+  bool mark_async_request_complete(const watch_notify::AsyncRequestId &id,
+                                   int r);
   Context *remove_async_request(const watch_notify::AsyncRequestId &id);
   void schedule_async_request_timed_out(const watch_notify::AsyncRequestId &id);
   void async_request_timed_out(const watch_notify::AsyncRequestId &id);