X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=ceph%2Fsrc%2Fcls%2Fcmpomap%2Fserver.cc;fp=ceph%2Fsrc%2Fcls%2Fcmpomap%2Fserver.cc;h=86e16d940f3efc2bfc484b8606fbdb84e2f87c2f;hb=522d829b51d55703d604fa6a2177d1ec6ece4586;hp=691832bfe63663f4e244ac6556d4a51ff35e50de;hpb=a7eef15ae04398ff74cc814724494ccfa88bdb84;p=ceph.git diff --git a/ceph/src/cls/cmpomap/server.cc b/ceph/src/cls/cmpomap/server.cc index 691832bfe..86e16d940 100644 --- a/ceph/src/cls/cmpomap/server.cc +++ b/ceph/src/cls/cmpomap/server.cc @@ -37,17 +37,20 @@ static int compare_values(Op op, const T& lhs, const T& rhs) static int compare_values_u64(Op op, uint64_t lhs, const bufferlist& value) { - try { - // decode existing value as rhs - uint64_t rhs; - auto p = value.cbegin(); - using ceph::decode; - decode(rhs, p); - return compare_values(op, lhs, rhs); - } catch (const buffer::error&) { - // failures to decode existing values are reported as EIO - return -EIO; + // empty values compare as 0 for backward compat + uint64_t rhs = 0; + if (value.length()) { + try { + // decode existing value as rhs + auto p = value.cbegin(); + using ceph::decode; + decode(rhs, p); + } catch (const buffer::error&) { + // failures to decode existing values are reported as EIO + return -EIO; + } } + return compare_values(op, lhs, rhs); } static int compare_value(Mode mode, Op op, const bufferlist& input,