]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd/api: avoid retrieving more than max mirror image info records 39964/head
authorJason Dillaman <dillaman@redhat.com>
Wed, 16 Dec 2020 15:15:28 +0000 (10:15 -0500)
committerJason Dillaman <dillaman@redhat.com>
Tue, 9 Mar 2021 21:38:33 +0000 (16:38 -0500)
This could otherwise result in an assertion failure in the API if
it failed to retrieve the status on an image and therefore required
a second iteration through the loop.

Fixes: https://tracker.ceph.com/issues/48522
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
(cherry picked from commit 77bc48bbadd8e8423e9342102475994632441eaa)

Conflicts:
src/librbd/api/Mirror.cc: conflict with new AsioEngine

src/librbd/api/Mirror.cc

index 0a868bf9761447ab8bd161a5f0f80ab1764a9deb..9687f321b8b7b319c7075a7482bdaee27e807b52 100644 (file)
@@ -1992,8 +1992,13 @@ int Mirror<I>::image_info_list(
 
       mirror_image_info_t info;
       r = image_get_info(io_ctx, op_work_queue, image_id, &info);
-      if (r >= 0) {
-        (*entries)[image_id] = std::make_pair(mode, info);
+      if (r < 0) {
+        continue;
+      }
+
+      (*entries)[image_id] = std::make_pair(mode, info);
+      if (entries->size() == max) {
+        break;
       }
     }