From: runsisi Date: Wed, 20 Apr 2016 01:55:39 +0000 (+0800) Subject: librbd: put the validation of image snap context earlier X-Git-Tag: v10.2.1~31^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F9046%2Fhead;p=ceph.git 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) --- 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(); }