]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
osd: set maximum object attr size
authorSage Weil <sage@inktank.com>
Sat, 29 Jun 2013 01:15:23 +0000 (18:15 -0700)
committerSage Weil <sage@inktank.com>
Sat, 29 Jun 2013 01:29:12 +0000 (18:29 -0700)
Make a well-defined maximum size of an object attribute.  Since Linus has
a 64KB limit, and that is what we normally use to back this, use that as
the limit.  This means that even when leveldb is backing large xattrs
(as ext4 users must do) we will return EFBIG on >64KB setxattr attempts.

Signed-off-by: Sage Weil <sage@inktank.com>
src/common/config_opts.h
src/osd/ReplicatedPG.cc

index 9eee57af9ebbe2c7779cfc36e88639d493a28320..775d54cac4872fd7c35947cb85b81fd6c3c55b7f 100644 (file)
@@ -489,6 +489,7 @@ OPTION(osd_recovery_op_priority, OPT_INT, 10)
 OPTION(osd_mon_shutdown_timeout, OPT_DOUBLE, 5)
 
 OPTION(osd_max_object_size, OPT_U64, 100*1024L*1024L*1024L) // OSD's maximum object size
+OPTION(osd_max_attr_size, OPT_U64, 65536)
 
 OPTION(filestore, OPT_BOOL, false)
 
index 4ce0404740c8ed1b37806df0830b4fd88a9ba05f..ada720ed36b334273fad5c22a1a3f3c923c0c53f 100644 (file)
@@ -2758,6 +2758,10 @@ int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
       
     case CEPH_OSD_OP_SETXATTR:
       {
+       if (op.xattr.value_len > g_conf->osd_max_attr_size) {
+         result = -EFBIG;
+         break;
+       }
        if (!obs.exists) {
          t.touch(coll, soid);
          ctx->delta_stats.num_objects++;