]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: on notify_quiesce() show attempts in a better format 50939/head
authorPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Fri, 7 Apr 2023 16:00:54 +0000 (21:30 +0530)
committerPrasanna Kumar Kalever <prasanna.kalever@redhat.com>
Thu, 13 Apr 2023 12:52:34 +0000 (18:22 +0530)
notify_quiesce() currently shows number of attempts in descending order,
this might be bit confusing to read.

Example: on the very first attempt,
2023-04-04T19:45:56.096+0530 7ff8ba7fc640 10 librbd::ImageWatcher:
  0x7ff898008b30 notify_quiesce: async_request_id=[4151,140705343226832,23] attempts=10

I initially misread the above means 10 attempts where done.

This commit tries to pick the format that is used by
ImageWatcher<I>::handle_payload() and ImageWatcher<I>::notify_async_progress()

Fixes: https://tracker.ceph.com/issues/59379
Signed-off-by: Prasanna Kumar Kalever <prasanna.kalever@redhat.com>
src/librbd/ImageWatcher.cc
src/librbd/ImageWatcher.h

index 85049fac74f9aa34727262f6367df4c6405cdafb..86148d3124b90d84b960c07b23db73b081b27b64 100644 (file)
@@ -393,37 +393,35 @@ void ImageWatcher<I>::notify_quiesce(uint64_t *request_id,
 
   AsyncRequestId async_request_id(get_client_id(), *request_id);
 
-  auto attempts = m_image_ctx.config.template get_val<uint64_t>(
+  auto total_attempts = m_image_ctx.config.template get_val<uint64_t>(
     "rbd_quiesce_notification_attempts");
 
-  notify_quiesce(async_request_id, attempts, prog_ctx, on_finish);
+  notify_quiesce(async_request_id, 1, total_attempts, prog_ctx, on_finish);
 }
 
 template <typename I>
 void ImageWatcher<I>::notify_quiesce(const AsyncRequestId &async_request_id,
-                                     size_t attempts, ProgressContext &prog_ctx,
+                                     size_t attempt, size_t total_attempts,
+                                     ProgressContext &prog_ctx,
                                      Context *on_finish) {
+  ceph_assert(attempt <= total_attempts);
   ldout(m_image_ctx.cct, 10) << this << " " << __func__ << ": async_request_id="
-                             << async_request_id << " attempts=" << attempts
-                             << dendl;
+                             << async_request_id << " attempts @ "
+                             << attempt << "/" << total_attempts << dendl;
 
-  ceph_assert(attempts > 0);
   auto notify_response = new watcher::NotifyResponse();
   auto on_notify = new LambdaContext(
     [notify_response=std::unique_ptr<watcher::NotifyResponse>(notify_response),
-     this, async_request_id, &prog_ctx, on_finish, attempts=attempts-1](int r) {
-      auto total_attempts = m_image_ctx.config.template get_val<uint64_t>(
-        "rbd_quiesce_notification_attempts");
-      if (total_attempts < attempts) {
-        total_attempts = attempts;
-      }
-      prog_ctx.update_progress(total_attempts - attempts, total_attempts);
-
+     this, async_request_id, attempt, total_attempts, &prog_ctx,
+     on_finish](int r) {
+      prog_ctx.update_progress(attempt, total_attempts);
       if (r == -ETIMEDOUT) {
-        ldout(m_image_ctx.cct, 10) << this << " " << __func__ << ": async_request_id="
-                                   << async_request_id << " timed out" << dendl;
-        if (attempts > 0) {
-          notify_quiesce(async_request_id, attempts, prog_ctx, on_finish);
+        ldout(m_image_ctx.cct, 10) << this << " " << __func__
+                                   << ": async_request_id=" << async_request_id
+                                   << " timed out" << dendl;
+        if (attempt < total_attempts) {
+          notify_quiesce(async_request_id, attempt + 1, total_attempts,
+                         prog_ctx, on_finish);
           return;
         }
       } else if (r == 0) {
index cda9a246e0eec57b65bfa9f801cc19baa3906575..1281320110d67c115b30197deee7e9523fe0a4b5 100644 (file)
@@ -241,8 +241,8 @@ private:
   void cancel_quiesce_requests();
 
   void notify_quiesce(const watch_notify::AsyncRequestId &async_request_id,
-                      size_t attempts, ProgressContext &prog_ctx,
-                      Context *on_finish);
+                      size_t attempt, size_t total_attempts,
+                      ProgressContext &prog_ctx, Context *on_finish);
 
   bool handle_operation_request(
     const watch_notify::AsyncRequestId& async_request_id,