]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
librbd: put the validation of image snap context earlier 8661/head
authorrunsisi <runsisi@zte.com.cn>
Wed, 20 Apr 2016 01:55:39 +0000 (09:55 +0800)
committerrunsisi <runsisi@zte.com.cn>
Wed, 20 Apr 2016 04:29:43 +0000 (12:29 +0800)
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>
src/librbd/image/RefreshRequest.cc

index ecb7cae7bdf4d2d8530037acb8b8852555405036..7d08b6d6bd76939f7b0a895caadc022094f52a2a 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();
 }