]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix prepare_atomic_for_write
authorYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 19 Aug 2011 23:20:55 +0000 (16:20 -0700)
committerYehuda Sadeh <yehuda@hq.newdream.net>
Fri, 19 Aug 2011 23:21:15 +0000 (16:21 -0700)
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h

index 021b08f0d65848a6f7ea90a2a294254684605dab..4c5a182d6f16ccb356d9f4f7c1c89a07247e1c1b 100644 (file)
@@ -916,8 +916,10 @@ int RGWRados::prepare_atomic_for_write_impl(RGWRadosCtx *rctx, rgw_obj& obj, lib
 int RGWRados::prepare_atomic_for_write(RGWRadosCtx *rctx, rgw_obj& obj, librados::IoCtx& io_ctx,
                             string& actual_obj, ObjectWriteOperation& op, RGWObjState **pstate)
 {
-  if (!rctx)
+  if (!rctx) {
+    *pstate = NULL;
     return 0;
+  }
 
   int r;
   do {
@@ -1218,7 +1220,7 @@ int RGWRados::clone_objs(void *ctx, rgw_obj& dst_obj,
   int r;
   do {
     r = clone_objs_impl(ctx, dst_obj, ranges, attrs, category, pmtime, truncate_dest, xattr_cond);
-  } while (r == -ECANCELED);
+  } while (ctx && r == -ECANCELED);
   return r;
 }
 
index c645354aee39f9dbfcac3d40ba953e12b0f55e79..4e3d94be7522d391227febe4a8549cb137d8e414 100644 (file)
@@ -91,7 +91,7 @@ class RGWRados  : public RGWAccess
                          string& actual_obj, librados::ObjectWriteOperation& op, RGWObjState **pstate);
 
   void atomic_write_finish(RGWObjState *state, int r) {
-    if (r == -ECANCELED) {
+    if (state && r == -ECANCELED) {
       state->clear();
     }
   }