object_cacher->stop();
}
- void ImageCtx::invalidate_cache() {
+ int ImageCtx::invalidate_cache() {
if (!object_cacher)
- return;
+ return 0;
cache_lock.Lock();
object_cacher->release_set(object_set);
cache_lock.Unlock();
cache_lock.Lock();
bool unclean = object_cacher->release_set(object_set);
cache_lock.Unlock();
- if (unclean)
- lderr(cct) << "could not release all objects from cache" << dendl;
+ if (unclean) {
+ lderr(cct) << "could not release all objects from cache: "
+ << unclean << " bytes remain" << dendl;
+ return -EBUSY;
+ }
+ return r;
}
void ImageCtx::clear_nonexistence_cache() {
void flush_cache_aio(Context *onfinish);
int flush_cache();
void shutdown_cache();
- void invalidate_cache();
+ int invalidate_cache();
void clear_nonexistence_cache();
int register_watch();
void unregister_watch();
if (size < ictx->size && ictx->object_cacher) {
// need to invalidate since we're deleting objects, and
// ObjectCacher doesn't track non-existent objects
- ictx->invalidate_cache();
+ r = ictx->invalidate_cache();
+ if (r < 0)
+ return r;
}
resize_helper(ictx, size, prog_ctx);
// need to flush any pending writes before resizing and rolling back -
// writes might create new snapshots. Rolling back will replace
// the current version, so we have to invalidate that too.
- ictx->invalidate_cache();
+ r = ictx->invalidate_cache();
+ if (r < 0)
+ return r;
ldout(cct, 2) << "resizing to snapshot size..." << dendl;
NoOpProgressContext no_op;