]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix data corruption when rados op return ETIMEDOUT
authorlu.shasha <lu.shasha@aishu.cn>
Tue, 3 Dec 2024 07:46:35 +0000 (15:46 +0800)
committerlu.shasha <lu.shasha@aishu.cn>
Tue, 3 Dec 2024 07:56:30 +0000 (15:56 +0800)
when rados op return ETIMEOUT, rgw can't determine whether or not the rados op succeeded,
To avoid data corruption, when return -ETIMEDOUT, we should clear all objects in RadosWriter

Signed-off-by: Shasha Lu <lu.shasha@aishu.cn>
src/rgw/driver/rados/rgw_putobj_processor.cc

index f04ed1db8d41e2387ff15f317e62185215dbad87..9e27c5adbc9ffc231738361ad1761a558d795c65 100644 (file)
@@ -597,6 +597,11 @@ int MultipartObjectProcessor::complete(
   }
 
   if (r < 0) {
+    if (r == -ETIMEDOUT) {
+      // The meta_obj_ref write may eventually succeed, clear the set of objects for deletion. if it
+      // doesn't ever succeed, we'll orphan any tail objects as if we'd crashed before that write
+      writer.clear_written();
+    }
     return r == -ENOENT ? -ERR_NO_SUCH_UPLOAD : r;
   }
 
@@ -783,6 +788,11 @@ int AppendObjectProcessor::complete(
                        attrs, rctx, writer.get_trace(),
                        flags & rgw::sal::FLAG_LOG_OP);
   if (r < 0) {
+      if (r == -ETIMEDOUT) {
+      // The head object write may eventually succeed, clear the set of objects for deletion. if it
+      // doesn't ever succeed, we'll orphan any tail objects as if we'd crashed before that write
+      writer.clear_written();
+    }
     return r;
   }
   if (!obj_op.meta.canceled) {