From: Mykola Golub Date: Tue, 22 Jan 2019 15:54:20 +0000 (+0200) Subject: librbd: properly filter out trashed non-user images on purge X-Git-Tag: v14.1.0~310^2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=3d01cc627137d7f270969653fbae4b6230361d7a;p=ceph-ci.git librbd: properly filter out trashed non-user images on purge Fixes: https://tracker.ceph.com/issues/38006 Signed-off-by: Mykola Golub --- diff --git a/src/librbd/api/Trash.cc b/src/librbd/api/Trash.cc index 1f0b1ffd8a3..83f420585c2 100644 --- a/src/librbd/api/Trash.cc +++ b/src/librbd/api/Trash.cc @@ -284,11 +284,12 @@ int Trash::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 to_be_removed; if (threshold != -1) {