ceph osd crush add osd.123 <weight> <location ...>
ceph osd crush add 123 <weight> <location ...>
+
+* There is now a maximum RADOS object size, configurable via 'osd max
+ object size', defaulting to 100 GB. Note that this has no effect on
+ RBD, CephFS, or radosgw, which all stripe over objects.
+
+
\ No newline at end of file
// Max time to wait between notifying mon of shutdown and shutting down
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(filestore, OPT_BOOL, false)
/// filestore wb throttle limits
return result;
}
+static int check_offset_and_length(__le64 offset, __le64 length)
+{
+ if (length < 1)
+ return -EINVAL;
+
+ if (offset >= g_conf->osd_max_object_size ||
+ length > g_conf->osd_max_object_size ||
+ offset + length > g_conf->osd_max_object_size)
+ return -EFBIG;
+
+ return 0;
+}
+
int ReplicatedPG::do_osd_ops(OpContext *ctx, vector<OSDOp>& ops)
{
int result = 0;
// munge ZERO -> TRUNCATE? (don't munge to DELETE or we risk hosing attributes)
if (op.op == CEPH_OSD_OP_ZERO &&
obs.exists &&
+ op.extent.offset < g_conf->osd_max_object_size &&
+ op.extent.length >= 1 &&
+ op.extent.length <= g_conf->osd_max_object_size &&
op.extent.offset + op.extent.length >= oi.size) {
+ if (op.extent.offset >= oi.size) {
+ // no-op
+ goto fail;
+ }
dout(10) << " munging ZERO " << op.extent.offset << "~" << op.extent.length
<< " -> TRUNCATE " << op.extent.offset << " (old size is " << oi.size << ")" << dendl;
op.op = CEPH_OSD_OP_TRUNCATE;
oi.truncate_size = op.extent.truncate_size;
}
}
+ result = check_offset_and_length(op.extent.offset, op.extent.length);
+ if (result < 0)
+ break;
bufferlist nbl;
bp.copy(op.extent.length, nbl);
t.write(coll, soid, op.extent.offset, op.extent.length, nbl);
case CEPH_OSD_OP_WRITEFULL:
{ // write full object
+ result = check_offset_and_length(op.extent.offset, op.extent.length);
+ if (result < 0)
+ break;
bufferlist nbl;
bp.copy(op.extent.length, nbl);
if (obs.exists) {
case CEPH_OSD_OP_ZERO:
{ // zero
+ result = check_offset_and_length(op.extent.offset, op.extent.length);
+ if (result < 0)
+ break;
assert(op.extent.length);
if (obs.exists) {
t.zero(coll, soid, op.extent.offset, op.extent.length);
break;
}
+ if (op.extent.offset > g_conf->osd_max_object_size) {
+ result = -EFBIG;
+ break;
+ }
+
if (op.extent.truncate_seq) {
assert(op.extent.offset == op.extent.truncate_size);
if (op.extent.truncate_seq <= oi.truncate_seq) {