mirror of
https://github.com/ceph/ceph
synced 2025-01-20 01:51:34 +00:00
librbd: resolve static analyser warnings
Signed-off-by: Jason Dillaman <dillaman@redhat.com>
This commit is contained in:
parent
59c0108241
commit
5f2689b62a
@ -2712,19 +2712,19 @@ int metadata_get(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
|
||||
int snapshot_get_limit(cls_method_context_t hctx, bufferlist *in,
|
||||
bufferlist *out)
|
||||
{
|
||||
int rc;
|
||||
uint64_t snap_limit;
|
||||
|
||||
rc = read_key(hctx, "snap_limit", &snap_limit);
|
||||
if (rc == -ENOENT) {
|
||||
rc = 0;
|
||||
::encode(UINT64_MAX, *out);
|
||||
} else {
|
||||
::encode(snap_limit, *out);
|
||||
int r = read_key(hctx, "snap_limit", &snap_limit);
|
||||
if (r == -ENOENT) {
|
||||
snap_limit = UINT64_MAX;
|
||||
} else if (r < 0) {
|
||||
CLS_ERR("error retrieving snapshot limit: %s", cpp_strerror(r).c_str());
|
||||
return r;
|
||||
}
|
||||
|
||||
CLS_LOG(20, "read snapshot limit %lu", snap_limit);
|
||||
return rc;
|
||||
::encode(snap_limit, *out);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snapshot_set_limit(cls_method_context_t hctx, bufferlist *in,
|
||||
@ -3777,7 +3777,10 @@ int mirror_peer_add(cls_method_context_t hctx, bufferlist *in,
|
||||
|
||||
std::string mirror_uuid;
|
||||
r = mirror::uuid_get(hctx, &mirror_uuid);
|
||||
if (mirror_peer.uuid == mirror_uuid) {
|
||||
if (r < 0) {
|
||||
CLS_ERR("error retrieving mirroring uuid: %s", cpp_strerror(r).c_str());
|
||||
return r;
|
||||
} else if (mirror_peer.uuid == mirror_uuid) {
|
||||
CLS_ERR("peer uuid '%s' matches pool mirroring uuid",
|
||||
mirror_uuid.c_str());
|
||||
return -EINVAL;
|
||||
|
@ -472,7 +472,7 @@ uint64_t AioImageWrite<I>::append_journal_event(
|
||||
const AioObjectRequests &requests, bool synchronous) {
|
||||
I &image_ctx = this->m_image_ctx;
|
||||
|
||||
uint64_t tid;
|
||||
uint64_t tid = 0;
|
||||
uint64_t buffer_offset = 0;
|
||||
assert(!this->m_image_extents.empty());
|
||||
for (auto &extent : this->m_image_extents) {
|
||||
@ -561,7 +561,7 @@ uint64_t AioImageDiscard<I>::append_journal_event(
|
||||
const AioObjectRequests &requests, bool synchronous) {
|
||||
I &image_ctx = this->m_image_ctx;
|
||||
|
||||
uint64_t tid;
|
||||
uint64_t tid = 0;
|
||||
assert(!this->m_image_extents.empty());
|
||||
for (auto &extent : this->m_image_extents) {
|
||||
journal::EventEntry event_entry(journal::AioDiscardEvent(extent.first,
|
||||
|
@ -412,7 +412,7 @@ Context *CreateRequest<I>::handle_negotiate_features(int *result) {
|
||||
ldout(m_cct, 20) << __func__ << ": r=" << *result << dendl;
|
||||
|
||||
uint64_t all_features;
|
||||
if (*result == 0) {
|
||||
if (*result >= 0) {
|
||||
bufferlist::iterator it = m_outbl.begin();
|
||||
*result = cls_client::get_all_features_finish(&it, &all_features);
|
||||
}
|
||||
|
@ -3029,6 +3029,7 @@ void filter_out_mirror_watchers(ImageCtx *ictx,
|
||||
if (r < 0) {
|
||||
lderr(cct) << "error enabling mirroring for image "
|
||||
<< img_pair.first << ": " << cpp_strerror(r) << dendl;
|
||||
img_ctx->state->close();
|
||||
return r;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user