From 357ad37a4facc9917866c780892c7cd0e21653fd Mon Sep 17 00:00:00 2001 From: runsisi Date: Wed, 20 Apr 2016 09:55:39 +0800 Subject: [PATCH] librbd: put the validation of image snap context earlier we'd better validate the snap context right after we got the mutable metadata before we could go any further Signed-off-by: runsisi (cherry picked from commit ca8ae66ba42e7a598ad23ed911938589dc288456) --- src/librbd/image/RefreshRequest.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/librbd/image/RefreshRequest.cc b/src/librbd/image/RefreshRequest.cc index 7d9ab78440a0..289cf5a2844c 100644 --- a/src/librbd/image/RefreshRequest.cc +++ b/src/librbd/image/RefreshRequest.cc @@ -245,6 +245,12 @@ Context *RefreshRequest::handle_v2_get_mutable_metadata(int *result) { return m_on_finish; } + if (!m_snapc.is_valid()) { + lderr(cct) << "image snap context is invalid!" << dendl; + *result = -EIO; + return m_on_finish; + } + send_v2_get_flags(); return nullptr; } @@ -352,12 +358,6 @@ Context *RefreshRequest::handle_v2_get_snapshots(int *result) { return m_on_finish; } - if (!m_snapc.is_valid()) { - lderr(cct) << "image snap context is invalid!" << dendl; - *result = -EIO; - return m_on_finish; - } - return send_v2_refresh_parent(); } -- 2.47.3