From: Sage Weil Date: Sat, 11 Feb 2012 00:47:33 +0000 (-0800) Subject: osd: check for valid snapc _before_ doing op work X-Git-Tag: v0.42~39 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=4834c4c7462630c38f9dddd56fea6835829f36db;p=ceph.git osd: check for valid snapc _before_ doing op work Check this early to avoid wasting effort, or causing side-effects from do_osd_op_effects(). Signed-off-by: Sage Weil --- diff --git a/src/osd/ReplicatedPG.cc b/src/osd/ReplicatedPG.cc index 158c049a8842..b98a4e6308ef 100644 --- a/src/osd/ReplicatedPG.cc +++ b/src/osd/ReplicatedPG.cc @@ -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) {