MCPcopy Create free account
hub / github.com/ceph/ceph / cls_2pc_queue_abort

Function cls_2pc_queue_abort

src/cls/2pc_queue/cls_2pc_queue.cc:377–462  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

375}
376
377static int cls_2pc_queue_abort(cls_method_context_t hctx, bufferlist *in, bufferlist *out) {
378 cls_2pc_queue_abort_op abort_op;
379 try {
380 auto in_iter = in->cbegin();
381 decode(abort_op, in_iter);
382 } catch (ceph::buffer::error& err) {
383 CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode entry: %s", err.what());
384 return -EINVAL;
385 }
386
387 // get head
388 cls_queue_head head;
389 int ret = queue_read_head(hctx, head);
390 if (ret < 0) {
391 return ret;
392 }
393
394 cls_2pc_urgent_data urgent_data;
395 try {
396 auto in_iter = head.bl_urgent_data.cbegin();
397 decode(urgent_data, in_iter);
398 } catch (ceph::buffer::error& err) {
399 CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode entry: %s", err.what());
400 return -EINVAL;
401 }
402
403 auto it = urgent_data.reservations.find(abort_op.id);
404 uint64_t reservation_size;
405 if (it == urgent_data.reservations.end()) {
406 if (!urgent_data.has_xattrs) {
407 CLS_LOG(20, "INFO: cls_2pc_queue_abort: reservation does not exist: %u", abort_op.id);
408 return 0;
409 }
410 // try to look for the reservation in xattrs
411 bufferlist bl_xattrs;
412 auto ret = cls_cxx_getxattr(hctx, CLS_QUEUE_URGENT_DATA_XATTR_NAME, &bl_xattrs);
413 if (ret < 0) {
414 if (ret == -ENOENT || ret == -ENODATA) {
415 // no xattrs, reservation does not exists
416 CLS_LOG(20, "INFO: cls_2pc_queue_abort: reservation does not exist: %u", abort_op.id);
417 return 0;
418 }
419 CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to read xattrs with: %d", ret);
420 return ret;
421 }
422 auto iter = bl_xattrs.cbegin();
423 cls_2pc_reservations xattr_reservations;
424 try {
425 decode(xattr_reservations, iter);
426 } catch (ceph::buffer::error& err) {
427 CLS_LOG(1, "ERROR: cls_2pc_queue_abort: failed to decode xattrs urgent data map");
428 return -EINVAL;
429 } //end - catch
430 it = xattr_reservations.find(abort_op.id);
431 if (it == xattr_reservations.end()) {
432 CLS_LOG(20, "INFO: cls_2pc_queue_abort: reservation does not exist: %u", abort_op.id);
433 return 0;
434 }

Callers 3

publish_commitFunction · 0.50
publish_abortFunction · 0.50
TEST_FFunction · 0.50

Calls 12

queue_read_headFunction · 0.85
queue_write_headFunction · 0.85
decodeFunction · 0.50
cls_cxx_getxattrFunction · 0.50
encodeFunction · 0.50
cls_cxx_setxattrFunction · 0.50
cbeginMethod · 0.45
whatMethod · 0.45
findMethod · 0.45
endMethod · 0.45
eraseMethod · 0.45
clearMethod · 0.45

Tested by 1

TEST_FFunction · 0.40