Skip to content

rgw: account presigned POST bytes_received in usage log - #68571

Merged
adamemerson merged 1 commit into
ceph:mainfrom
lumir-sliva:wip-rgw-postobj-bytes-received
May 15, 2026
Merged

adamemerson merged 1 commit into
ceph:mainfrom
lumir-sliva:wip-rgw-postobj-bytes-received

Conversation

@lumir-sliva

@lumir-sliva lumir-sliva commented Apr 23, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Presigned POST uploads report bytes_received=0 in the usage log (radosgw-admin usage show), while equivalent PUT uploads report the full object size. Operators using the usage log for bandwidth accounting or billing undercount any traffic uploaded via presigned POST (browser form uploads, JavaScript SDKs, etc.).

Cause

The AccountingFilter (src/rgw/rgw_client_io_filters.h) starts with enabled=false, so any recv_body call made while it is off contributes nothing to total_received. The PUT path explicitly toggles it on around its body read in RGWPutObj_ObjStore::get_data. The POST path does not. All POST body bytes pass through RGWPostObj_ObjStore::read_with_boundary, whose two recv_body call sites run with accounting off, so every byte pulled off the wire during multipart parsing is silently dropped by the accounter.

Fix

Wrap the two recv_body calls in read_with_boundary with ACCOUNTING_IO(s)->set_account(true/false), mirroring the PUT pattern. POST uploads now account correctly; PUT behavior is unchanged.

Test

Reproduced and verified the fix on a vstart cluster (bluestore, rgw_enable_usage_log=true) by uploading the same 1 MiB body to the same bucket twice, once via put_object and once via generate_presigned_post + multipart form POST.

Before the patch:

post_obj  ops=1  bytes_received=0
put_obj   ops=1  bytes_received=1048576

After the patch:

post_obj  ops=1  bytes_received=1049891
put_obj   ops=1  bytes_received=1048576

The POST total matches the 1 MiB file body plus the ~1.3 KiB of multipart boundaries and part headers that the wire actually carried.

Tracker: https://tracker.ceph.com/issues/76157

Checklist

  • Tracker (select at least one)
    • References tracker ticket
    • Very recent bug; references commit where it was introduced
    • New feature (ticket optional)
    • Doc update (no ticket needed)
    • Code cleanup (no ticket needed)
  • Component impact
    • Affects Dashboard, opened tracker ticket
    • Affects Orchestrator, opened tracker ticket
    • No impact that needs to be tracked
  • Documentation (select at least one)
    • Updates relevant documentation
    • No doc update is appropriate
  • Tests (select at least one)
    • Includes unit test(s)
    • Includes integration test(s)
    • Includes bug reproducer
    • No tests

@lumir-sliva
lumir-sliva requested a review from a team as a code owner April 23, 2026 11:23
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

13 similar comments
@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@ceph-jenkins

Copy link
Copy Markdown
Collaborator

Thank you for your contribution. Since you, the author, are not a member of the Ceph GitHub Org yet, our CI will not automatically run. Any member of the Ceph Org may comment "ok - to - test" (without the dashes) to allow the Jenkins jobs to run.

@cbodley cbodley left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lumir-sliva thanks very much for the fix, it looks simple and correct

and thanks for the test coverage, it's great to see that it works. my only concern is that it adds 3 new files to test a very specific issue, and these test scripts carry an ongoing maintenance burden. can i kindly ask you to remove the test changes so we can merge just the fix to rgw_rest.cc?

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 <[email protected]>
Tracker: https://tracker.ceph.com/issues/76157
Reported-by: Maxim Monin
@lumir-sliva
lumir-sliva force-pushed the wip-rgw-postobj-bytes-received branch from 3025e02 to 7d2484c Compare April 23, 2026 19:26
@lumir-sliva

Copy link
Copy Markdown
Contributor Author

got you casey

@anrao19

anrao19 commented Apr 30, 2026

Copy link
Copy Markdown
Contributor

@anrao19

anrao19 commented May 15, 2026

Copy link
Copy Markdown
Contributor

pr testing is in progress... More details : https://tracker.ceph.com/issues/76301

pr testing completed and approved by @adamemerson , more details In : https://tracker.ceph.com/issues/76301.
@lumir-sliva if no further testing is needed, this pr can be , merged

@lumir-sliva

Copy link
Copy Markdown
Contributor Author

pr testing is in progress... More details : https://tracker.ceph.com/issues/76301

pr testing completed and approved by @adamemerson , more details In : https://tracker.ceph.com/issues/76301. @lumir-sliva if no further testing is needed, this pr can be , merged

Thanks, maybe @cbodley would you be so kind and press the button. TIA

@adamemerson
adamemerson merged commit cf1d052 into ceph:main May 15, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants