]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: reset complete async request expiration time 45019/head
authorMykola Golub <mgolub@suse.com>
Tue, 29 Sep 2020 09:07:56 +0000 (10:07 +0100)
committerMykola Golub <mgolub@suse.com>
Tue, 15 Feb 2022 07:32:14 +0000 (07:32 +0000)
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 5c3ba95b4d1208868db1d00d1ba06ed086e1b268)

Conflicts:
src/librbd/ImageWatcher.cc (no quiesce requests in octopus,
            AsyncRequestId == operator is not supported, use !=)

src/librbd/ImageWatcher.cc

index 02a52a65fa464278f058f9819c76d094105448f1..50ac0facc4eb0f5eefda8fcfb543f8e994cb400a 100644 (file)
@@ -511,11 +511,18 @@ bool ImageWatcher<I>::mark_async_request_complete(const AsyncRequestId &id,
     it = m_async_complete_expiration.erase(it);
   }
 
-  if (m_async_complete.insert({id, r}).second) {
-    auto expiration_time = now;
-    expiration_time += 600;
-    m_async_complete_expiration.insert({expiration_time, id});
+  if (!m_async_complete.insert({id, r}).second) {
+    for (it = m_async_complete_expiration.begin();
+         it != m_async_complete_expiration.end(); it++) {
+      if (!(it->second != id)) {
+        m_async_complete_expiration.erase(it);
+        break;
+      }
+    }
   }
+  auto expiration_time = now;
+  expiration_time += 600;
+  m_async_complete_expiration.insert({expiration_time, id});
 
   return found;
 }
@@ -610,7 +617,10 @@ int ImageWatcher<I>::prepare_async_request(const AsyncRequestId& async_request_i
       *new_request = false;
       auto it = m_async_complete.find(async_request_id);
       if (it != m_async_complete.end()) {
-        return it->second;
+        int r = it->second;
+        // reset complete request expiration time
+        mark_async_request_complete(async_request_id, r);
+        return r;
       }
     }
   }