]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
rgw: account presigned POST bytes_received in usage log 68571/head
authorLumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
Thu, 23 Apr 2026 11:18:18 +0000 (13:18 +0200)
committerLumir Sliva <61183145+lumir-sliva@users.noreply.github.com>
Thu, 23 Apr 2026 19:24:45 +0000 (21:24 +0200)
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
src/rgw/rgw_rest.cc

index c592b7d2411d403f4812eb3900804a406a592715..9112cfe020da93dc1fbc8cc35aa39ae84c909e60 100644 (file)
@@ -1233,7 +1233,9 @@ int RGWPostObj_ObjStore::read_with_boundary(ceph::bufferlist& bl,
 
     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;
     }
@@ -1265,7 +1267,9 @@ int RGWPostObj_ObjStore::read_with_boundary(ceph::bufferlist& bl,
     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;
       }