From dd93e009a222e8e86041661742b4df9c92b097f7 Mon Sep 17 00:00:00 2001 From: Vikhyat Umrao Date: Mon, 27 Jun 2016 23:36:09 +0530 Subject: [PATCH] rbd: cleanup - Proxied operations shouldn't result in error messages if replayed Fixes: http://tracker.ceph.com/issues/16130 Signed-off-by: Vikhyat Umrao (cherry picked from commit d09c9c471f40f15c14f392a93a04353ca30b1c5e) --- src/librbd/operation/RenameRequest.cc | 6 +++++- src/librbd/operation/SnapshotProtectRequest.cc | 6 +++++- src/librbd/operation/SnapshotRemoveRequest.cc | 6 +++++- src/librbd/operation/SnapshotRenameRequest.cc | 6 +++++- src/librbd/operation/SnapshotUnprotectRequest.cc | 6 +++++- 5 files changed, 25 insertions(+), 5 deletions(-) diff --git a/src/librbd/operation/RenameRequest.cc b/src/librbd/operation/RenameRequest.cc index 3d23579af7e6f..cfd54d1d86040 100644 --- a/src/librbd/operation/RenameRequest.cc +++ b/src/librbd/operation/RenameRequest.cc @@ -66,7 +66,11 @@ bool RenameRequest::should_complete(int r) { << "r=" << r << dendl; r = filter_state_return_code(r); if (r < 0) { - lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + if (r == -EEXIST) { + ldout(cct, 1) << "image already exists" << dendl; + } else { + lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + } return true; } diff --git a/src/librbd/operation/SnapshotProtectRequest.cc b/src/librbd/operation/SnapshotProtectRequest.cc index 9ba415e4cf9dc..409d9983c40ac 100644 --- a/src/librbd/operation/SnapshotProtectRequest.cc +++ b/src/librbd/operation/SnapshotProtectRequest.cc @@ -47,7 +47,11 @@ bool SnapshotProtectRequest::should_complete(int r) { ldout(cct, 5) << this << " " << __func__ << ": state=" << m_state << ", " << "r=" << r << dendl; if (r < 0) { - lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + if (r == -EBUSY) { + ldout(cct, 1) << "snapshot is already protected" << dendl; + } else { + lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + } } return true; } diff --git a/src/librbd/operation/SnapshotRemoveRequest.cc b/src/librbd/operation/SnapshotRemoveRequest.cc index 9bc45679896c0..eadbfc2a106bf 100644 --- a/src/librbd/operation/SnapshotRemoveRequest.cc +++ b/src/librbd/operation/SnapshotRemoveRequest.cc @@ -135,7 +135,11 @@ void SnapshotRemoveRequest::send_remove_child() { parent_spec our_pspec; int r = image_ctx.get_parent_spec(m_snap_id, &our_pspec); if (r < 0) { - lderr(cct) << "failed to retrieve parent spec" << dendl; + if (r == -ENOENT) { + ldout(cct, 1) << "No such snapshot" << dendl; + } else { + lderr(cct) << "failed to retrieve parent spec" << dendl; + } m_state = STATE_ERROR; this->async_complete(r); diff --git a/src/librbd/operation/SnapshotRenameRequest.cc b/src/librbd/operation/SnapshotRenameRequest.cc index c7148c8961af0..5b836cd061c9c 100644 --- a/src/librbd/operation/SnapshotRenameRequest.cc +++ b/src/librbd/operation/SnapshotRenameRequest.cc @@ -64,7 +64,11 @@ bool SnapshotRenameRequest::should_complete(int r) { ldout(cct, 5) << this << " " << __func__ << ": state=" << m_state << ", " << "r=" << r << dendl; if (r < 0) { - lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + if (r == -EEXIST) { + ldout(cct, 1) << "snapshot already exists" << dendl; + } else { + lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + } } return true; } diff --git a/src/librbd/operation/SnapshotUnprotectRequest.cc b/src/librbd/operation/SnapshotUnprotectRequest.cc index 5ca98f9d80a4f..0b7b7c4382b31 100644 --- a/src/librbd/operation/SnapshotUnprotectRequest.cc +++ b/src/librbd/operation/SnapshotUnprotectRequest.cc @@ -169,7 +169,11 @@ bool SnapshotUnprotectRequest::should_complete(int r) { ldout(cct, 5) << this << " " << __func__ << ": state=" << m_state << ", " << "r=" << r << dendl; if (r < 0) { - lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + if (r == -EINVAL) { + ldout(cct, 1) << "snapshot is already unprotected" << dendl; + } else { + lderr(cct) << "encountered error: " << cpp_strerror(r) << dendl; + } if (m_ret_val == 0) { m_ret_val = r; } -- 2.39.5