From: Sun Yuechi Date: Thu, 25 Jun 2026 14:15:46 +0000 (+0800) Subject: osd: fix osd_reqid_t comparison strict weak ordering X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=7c1e9773653f2575d6691e268a4266f22ba3b61e;p=ceph.git osd: fix osd_reqid_t comparison strict weak ordering The 'l.inc < r.inc' term in operator< lacked an 'l.name == r.name' guard, breaking antisymmetry, so it was not a valid strict weak ordering. Replace it with std::tie. The only ordered container keyed on osd_reqid_t is ECInject::write_failures0_reqid (QA/debug error injection), so no production code path is affected and no backport is needed. Signed-off-by: Sun Yuechi --- diff --git a/src/osd/osd_types.h b/src/osd/osd_types.h index 1065066948e..977af60bed3 100644 --- a/src/osd/osd_types.h +++ b/src/osd/osd_types.h @@ -28,6 +28,7 @@ #include #include #include +#include #include #ifdef WITH_CRIMSON @@ -240,12 +241,10 @@ inline bool operator!=(const osd_reqid_t& l, const osd_reqid_t& r) { return (l.name != r.name) || (l.inc != r.inc) || (l.tid != r.tid); } inline bool operator<(const osd_reqid_t& l, const osd_reqid_t& r) { - return (l.name < r.name) || (l.inc < r.inc) || - (l.name == r.name && l.inc == r.inc && l.tid < r.tid); + return std::tie(l.name, l.inc, l.tid) < std::tie(r.name, r.inc, r.tid); } inline bool operator<=(const osd_reqid_t& l, const osd_reqid_t& r) { - return (l.name < r.name) || (l.inc < r.inc) || - (l.name == r.name && l.inc == r.inc && l.tid <= r.tid); + return std::tie(l.name, l.inc, l.tid) <= std::tie(r.name, r.inc, r.tid); } inline bool operator>(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l <= r); } inline bool operator>=(const osd_reqid_t& l, const osd_reqid_t& r) { return !(l < r); }