From bbb89c760095b1aef692b5b15d0450d226971fdc Mon Sep 17 00:00:00 2001 From: xie xingguo Date: Mon, 11 Jan 2016 18:25:07 +0800 Subject: [PATCH] RBD: fix unhandle result code during list/list_children Fixes: #14333 Signed-off-by: xie xingguo --- src/librbd/internal.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/librbd/internal.cc b/src/librbd/internal.cc index 9368bceed4769..958be93de5cf8 100644 --- a/src/librbd/internal.cc +++ b/src/librbd/internal.cc @@ -677,8 +677,13 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) { string last_read = ""; do { map images; - cls_client::dir_list(&io_ctx, RBD_DIRECTORY, + r = cls_client::dir_list(&io_ctx, RBD_DIRECTORY, last_read, max_read, &images); + if (r < 0) { + lderr(cct) << "error listing image in directory: " + << cpp_strerror(r) << dendl; + return r; + } for (map::const_iterator it = images.begin(); it != images.end(); ++it) { names.push_back(it->first); @@ -711,7 +716,11 @@ int validate_pool(IoCtx &io_ctx, CephContext *cct) { // search all pools for children depending on this snapshot Rados rados(ictx->md_ctx); std::list > pools; - rados.pool_list2(pools); + r = rados.pool_list2(pools); + if (r < 0) { + lderr(cct) << "error listing pools: " << cpp_strerror(r) << dendl; + return r; + } for (std::list >::const_iterator it = pools.begin(); it != pools.end(); ++it) { -- 2.39.5