]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: fix data corruption due to network jitter 47667/head
authorlu.shasha <lu.shasha@aishu.cn>
Thu, 18 Aug 2022 07:07:42 +0000 (15:07 +0800)
committerShasha <lu.shasha@aishu.cn>
Tue, 23 Aug 2022 01:15:42 +0000 (09:15 +0800)
In function RGWRados::Object::Write::_do_write_meta rgw_rados_operate may return -ETIMEDOUT due to network jitter.
But head obj may eventually be written successfully even if return -ETIMEDOUT. Due to r < 0, meta.canceled be set true.
In such scenario, all the tail objects will removed in the destructor of RadosWriter, then data corruptted.
To avoid data corruption, when return -ETIMEDOUT, should clear all objects in RadosWriter.

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

index 0b4579169c5ad0c132a6e2feb2bc5bf9e066fd10..c2c2c476016f96303f51b2bd25a8803ea9aef6f2 100644 (file)
@@ -331,6 +331,11 @@ int AtomicObjectProcessor::complete(size_t accounted_size,
 
   r = obj_op.write_meta(dpp, actual_size, accounted_size, attrs, y);
   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) {