]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
librbd: properly filter out trashed non-user images on purge
authorMykola Golub <mgolub@suse.com>
Tue, 22 Jan 2019 15:54:20 +0000 (17:54 +0200)
committerMykola Golub <mgolub@suse.com>
Tue, 22 Jan 2019 15:54:20 +0000 (17:54 +0200)
Fixes: https://tracker.ceph.com/issues/38006
Signed-off-by: Mykola Golub <mgolub@suse.com>
src/librbd/api/Trash.cc

index 1f0b1ffd8a366555f38c06076151354b6f0b041a..83f420585c2d693d92bab9acb8fb8732b57538d5 100644 (file)
@@ -284,11 +284,12 @@ int Trash<I>::purge(IoCtx& io_ctx, time_t expire_ts,
     return r;
   }
 
-  std::remove_if(trash_entries.begin(), trash_entries.end(),
-      [](librbd::trash_image_info_t info) {
-        return info.source != RBD_TRASH_IMAGE_SOURCE_USER;
-      }
-  );
+  trash_entries.erase(
+      std::remove_if(trash_entries.begin(), trash_entries.end(),
+                     [](librbd::trash_image_info_t info) {
+                       return info.source != RBD_TRASH_IMAGE_SOURCE_USER;
+                     }),
+      trash_entries.end());
 
   std::set<std::string> to_be_removed;
   if (threshold != -1) {