]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
osd/PrimaryLogPG: impose a per-op return buffer limit (32)
authorSage Weil <sage@redhat.com>
Tue, 24 Sep 2019 19:51:45 +0000 (14:51 -0500)
committerSage Weil <sage@redhat.com>
Wed, 25 Sep 2019 18:29:10 +0000 (13:29 -0500)
Limit the return value size for writes, so that we don't inadvertantly
stuff too much data in the PGLog.

Signed-off-by: Sage Weil <sage@redhat.com>
src/common/legacy_config_opts.h
src/common/options.cc
src/osd/PrimaryLogPG.cc

index ddbf75b35c26e378927e0c0f3af018aa357e768c..e8d122ab01c7912111f070d10ee5ab45ca5af273 100644 (file)
@@ -886,6 +886,7 @@ OPTION(osd_max_attr_size, OPT_U64)
 
 OPTION(osd_max_omap_entries_per_request, OPT_U64)
 OPTION(osd_max_omap_bytes_per_request, OPT_U64)
+OPTION(osd_max_write_op_reply_len, OPT_U64)
 
 OPTION(osd_objectstore, OPT_STR)  // ObjectStore backend type
 OPTION(osd_objectstore_tracing, OPT_BOOL) // true if LTTng-UST tracepoints should be enabled
index 0ebbe4b3037cdb016196c7d162974b4bce830255..187a5111864fd4195334d0777e1998a9a3f5911c 100644 (file)
@@ -4129,6 +4129,11 @@ std::vector<Option> get_global_options() {
     .set_default(1_G)
     .set_description(""),
 
+    Option("osd_max_write_op_reply_len", Option::TYPE_SIZE, Option::LEVEL_ADVANCED)
+    .set_default(32)
+    .set_description("Max size of the per-op payload for requests with the RETURNVEC flag set")
+    .set_long_description("This value caps the amount of data (per op; a request may have many ops) that will be sent back to the client and recorded in the PG log."),
+
     Option("osd_objectstore", Option::TYPE_STR, Option::LEVEL_ADVANCED)
     .set_default("bluestore")
     .set_enum_allowed({"bluestore", "filestore", "memstore", "kstore"})
index 082adc52159c1112092a9c879c2941791c497736..d5b4ad26ace340bbe4f1846483390b48d4db153d 100644 (file)
@@ -3733,7 +3733,14 @@ void PrimaryLogPG::execute_ctx(OpContext *ctx)
     // successful update
     if (ctx->op->allows_returnvec()) {
       // enforce reasonable bound on the return buffer sizes
-#warning write me
+      for (auto& i : *ctx->ops) {
+       if (i.outdata.length() > cct->_conf->osd_max_write_op_reply_len) {
+         dout(10) << __func__ << " op " << i << " outdata overflow" << dendl;
+         result = -EOVERFLOW;  // overall result is overflow
+         i.rval = -EOVERFLOW;
+         i.outdata.clear();
+       }
+      }
     } else {
       // legacy behavior -- zero result and return data etc.
       ignore_out_data = true;