]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: put the validation of image snap context earlier 9046/head
authorrunsisi <runsisi@zte.com.cn>
Wed, 20 Apr 2016 01:55:39 +0000 (09:55 +0800)
committerJason Dillaman <dillaman@redhat.com>
Tue, 10 May 2016 16:32:07 +0000 (12:32 -0400)
we'd better validate the snap context right after we got the mutable
metadata before we could go any further

Signed-off-by: runsisi <runsisi@zte.com.cn>
(cherry picked from commit ca8ae66ba42e7a598ad23ed911938589dc288456)

src/librbd/image/RefreshRequest.cc

index 7d9ab78440a08306cbdb729bb396961da62dcc3a..289cf5a2844c919c5d26b1b67cb9812f11ce8bd3 100644 (file)
@@ -245,6 +245,12 @@ Context *RefreshRequest<I>::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<I>::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();
 }