]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix ECANCELED handling in rgw_get_system_obj() 20561/head
authorYehuda Sadeh <yehuda@redhat.com>
Tue, 22 Nov 2016 18:33:12 +0000 (10:33 -0800)
committerNathan Cutler <ncutler@suse.com>
Fri, 23 Feb 2018 15:03:38 +0000 (16:03 +0100)
Fixes: http://tracker.ceph.com/issues/17996
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
(cherry picked from commit e67a3b5b5c63ee3a34f06bdbe91d3256c6660a89)

Conflicts:
    src/rgw/rgw_rados.cc: used ctx.invalidate(obj) instead of ctx.raw.invalidate(obj)
        in RGWRados::SystemObject::invalidate_state()

src/cls/version/cls_version_types.h
src/rgw/rgw_rados.cc
src/rgw/rgw_rados.h
src/rgw/rgw_tools.cc

index 4b77e5dd26d3c2c2c07dbd1b3cec0dabc9cf6b5f..22ae0779ea308b718f86903cea6a142aeb2b4014 100644 (file)
@@ -31,6 +31,11 @@ struct obj_version {
     ver++;
   }
 
+  void clear() {
+    ver = 0;
+    tag.clear();
+  }
+
   bool empty() {
     return tag.empty();
   }
index 686e72f501bfc74cedf9951ca1a0a4a054cdaed1..2220e42ec3bed91f8c161a423b35943fc0b9970f 100644 (file)
@@ -8550,6 +8550,11 @@ void RGWRados::Object::invalidate_state()
   ctx.invalidate(obj);
 }
 
+void RGWRados::SystemObject::invalidate_state()
+{
+  ctx.invalidate(obj);
+}
+
 int RGWRados::Object::prepare_atomic_modification(ObjectWriteOperation& op, bool reset_obj, const string *ptag,
                                                   const char *if_match, const char *if_nomatch, bool removal_op)
 {
index 0c659c32f7b027872e5aa7052b787788608deb4d..b8cac75d22dee8a792afaa283cfc044505edc7f5 100644 (file)
@@ -2164,6 +2164,8 @@ public:
   public:
     SystemObject(RGWRados *_store, RGWObjectCtx& _ctx, rgw_obj& _obj) : store(_store), ctx(_ctx), obj(_obj), state(NULL) {}
 
+    void invalidate_state();
+
     RGWRados *get_store() { return store; }
     rgw_obj& get_obj() { return obj; }
     RGWObjectCtx& get_ctx() { return ctx; }
index 857e3a4b4b6e98330eb0bcce5577a8e7b02c0d73..3b2620e5820fd8b3d723c1799633e1dab53d6a0f 100644 (file)
@@ -47,6 +47,11 @@ int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_bucket& bu
   int request_len = READ_CHUNK_LEN;
   rgw_obj obj(bucket, key);
 
+  obj_version original_readv;
+  if (objv_tracker && !objv_tracker->read_version.empty()) {
+    original_readv = objv_tracker->read_version;
+  }
+
   do {
     RGWRados::SystemObject source(rgwstore, obj_ctx, obj);
     RGWRados::SystemObject::Read rop(&source);
@@ -64,6 +69,14 @@ int rgw_get_system_obj(RGWRados *rgwstore, RGWObjectCtx& obj_ctx, rgw_bucket& bu
     ret = rop.read(0, request_len - 1, bl, objv_tracker, refresh_version);
     if (ret == -ECANCELED) {
       /* raced, restart */
+      if (!original_readv.empty()) {
+        /* we were asked to read a specific obj_version, failed */
+        return ret;
+      }
+      if (objv_tracker) {
+        objv_tracker->read_version.clear();
+      }
+      source.invalidate_state();
       continue;
     }
     if (ret < 0)