]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: properly filter out trashed non-user images on purge 26137/head
authorMykola Golub <mgolub@suse.com>
Tue, 22 Jan 2019 15:54:20 +0000 (17:54 +0200)
committerAshish Singh <assingh@redhat.com>
Fri, 25 Jan 2019 07:44:15 +0000 (13:14 +0530)
Fixes: https://tracker.ceph.com/issues/38006
Signed-off-by: Mykola Golub <mgolub@suse.com>
(cherry picked from commit 3d01cc627137d7f270969653fbae4b6230361d7a)

Conflicts:
- src/librbd/api/Trash.cc
- src/tools/rbd/action/Trash.cc
    In mimic, the code that needs fixing was in
            'tools/rbd/action/Trash.cc'.

src/tools/rbd/action/Trash.cc

index 3bcceda75a36c3b76730701dd91ff168abf412d5..6313a5d205b261dec9173178190137588301626d 100644 (file)
@@ -393,11 +393,12 @@ int execute_purge (const po::variables_map &vm,
     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::vector<const char *> to_be_removed;