Presigned POST uploads reported bytes_received=0 in the usage log, while
equivalent PUT uploads reported the full object size.
The AccountingFilter starts disabled, and only the PUT path explicitly
enables it around its body read. POST bodies are consumed via
RGWPostObj_ObjStore::read_with_boundary, which did not toggle accounting
around its recv_body calls, so every byte pulled off the wire during
multipart parsing was silently dropped by the accounter.
Wrap the two recv_body calls in read_with_boundary with
ACCOUNTING_IO(s)->set_account(true/false), mirroring the PUT pattern in
RGWPutObj_ObjStore::get_data. POST uploads now account correctly; PUT
behavior is unchanged.
Signed-off-by: Lumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
Tracker: https://tracker.ceph.com/issues/76157
Reported-by: Maxim Monin
bufferptr bp(need_to_read);
+ ACCOUNTING_IO(s)->set_account(true);
const auto read_len = recv_body(s, bp.c_str(), need_to_read);
+ ACCOUNTING_IO(s)->set_account(false);
if (read_len < 0) {
return read_len;
}
if (left < skip + 2) {
int need = skip + 2 - left;
bufferptr boundary_bp(need);
+ ACCOUNTING_IO(s)->set_account(true);
const int r = recv_body(s, boundary_bp.c_str(), need);
+ ACCOUNTING_IO(s)->set_account(false);
if (r < 0) {
return r;
}