From: Kefu Chai Date: Wed, 24 Jun 2026 10:10:41 +0000 (+0800) Subject: crimson/osd: mark ThrottleReleaser [[nodiscard]] X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F69697%2Fhead;p=ceph.git crimson/osd: mark ThrottleReleaser [[nodiscard]] OperationThrottler::get_throttle() returns a ThrottleReleaser guard whose destructor calls release_throttle(), the mClock RequestCompletion that decrements in_progress. The guard has to be held for the whole operation: a caller that discards it at acquisition releases the slot in the same step, so the operation never counts against max_in_progress and the throttle does nothing. Mark the type [[nodiscard]] so the compiler flags a discarded co_await of get_throttle(). Signed-off-by: Kefu Chai --- diff --git a/src/crimson/osd/osd_operation.h b/src/crimson/osd/osd_operation.h index 000cf4057ef..e41cc1abf52 100644 --- a/src/crimson/osd/osd_operation.h +++ b/src/crimson/osd/osd_operation.h @@ -376,7 +376,11 @@ public: return !max_in_progress || in_progress < max_in_progress; } - class ThrottleReleaser { + // The returned guard's destructor is the mClock RequestCompletion + // (release_throttle), so it must be held for the throttled operation's whole + // lifetime. Dropping it at acquisition frees the slot immediately and the + // operation never counts against max_in_progress. + class [[nodiscard("discarding the guard releases the throttle slot immediately")]] ThrottleReleaser { OperationThrottler *parent = nullptr; public: ThrottleReleaser(OperationThrottler *parent) : parent(parent) {}