]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: check for valid snapc _before_ doing op work
authorSage Weil <sage@newdream.net>
Sat, 11 Feb 2012 00:47:33 +0000 (16:47 -0800)
committerSage Weil <sage@newdream.net>
Sat, 11 Feb 2012 19:48:27 +0000 (11:48 -0800)
Check this early to avoid wasting effort, or causing side-effects from
do_osd_op_effects().

Signed-off-by: Sage Weil <sage@newdream.net>
src/osd/ReplicatedPG.cc

index 158c049a88428b8fa737fd7289d8f4669360ff2e..b98a4e6308eff02980fc970b964bbabfe16d34f5 100644 (file)
@@ -2680,6 +2680,12 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
 
   bool head_existed = ctx->obs->exists;
 
+  // valid snap context?
+  if (!ctx->snapc.is_valid()) {
+    dout(10) << " invalid snapc " << ctx->snapc << dendl;
+    return -EINVAL;
+  }
+
   // prepare the actual mutation
   int result = do_osd_ops(ctx, ctx->ops);
   if (result < 0)
@@ -2697,13 +2703,6 @@ int ReplicatedPG::prepare_transaction(OpContext *ctx)
 
 
   // there was a modification!
-
-  // valid snap context?
-  if (!ctx->snapc.is_valid()) {
-    dout(10) << " invalid snapc " << ctx->snapc << dendl;
-    return -EINVAL;
-  }
-
   make_writeable(ctx);
 
   if (ctx->user_modify) {